/* Joy of China — Design System */
:root {
  --ink: #12141a;
  --ink-soft: #2a2e38;
  --ink-muted: #5c6370;
  --paper: #f7f8fa;
  --paper-warm: #eef1f4;
  --line: #d5dae3;
  --cinnabar: #c81e1e;
  --cinnabar-deep: #9e1515;
  --jade: #1f6b5c;
  --jade-soft: #e6f2ef;
  --gold: #b0892e;
  --ad-bg: #f0f2f5;
  --radius: 2px;
  --max: 1120px;
  --prose: 720px;
  --font-display: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, "Times New Roman", serif;
  --font-body: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  --shadow-soft: 0 12px 40px rgba(18, 20, 26, 0.08);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.7;
  color: var(--ink);
  background:
    radial-gradient(ellipse 80% 50% at 10% -10%, rgba(31, 107, 92, 0.07), transparent 55%),
    radial-gradient(ellipse 60% 40% at 100% 0%, rgba(200, 30, 30, 0.05), transparent 50%),
    linear-gradient(180deg, #fbfcfd 0%, var(--paper) 40%, #f3f5f8 100%);
  min-height: 100vh;
}

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

a {
  color: var(--jade);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  transition: color 0.2s var(--ease);
}

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

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.2;
  color: var(--ink);
  letter-spacing: -0.01em;
}

h1 { font-size: clamp(2rem, 4vw, 3rem); margin: 0 0 0.6em; }
h2 { font-size: clamp(1.45rem, 2.5vw, 1.85rem); margin: 1.6em 0 0.55em; }
h3 { font-size: 1.2rem; margin: 1.35em 0 0.45em; }

p { margin: 0 0 1.1em; }

ul, ol { margin: 0 0 1.2em; padding-left: 1.25em; }
li { margin-bottom: 0.4em; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.container {
  width: min(100% - 2rem, var(--max));
  margin-inline: auto;
}

.container--narrow {
  width: min(100% - 2rem, var(--prose));
}

/* —— Site header —— */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(247, 248, 250, 0.88);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 0;
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  text-decoration: none;
  color: inherit;
}

.brand:hover { color: inherit; }

.brand__name {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.brand__name span {
  color: var(--cinnabar);
}

.brand__tag {
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.nav {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.nav a {
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
}

.nav a:hover,
.nav a[aria-current="page"] {
  color: var(--cinnabar);
}

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--line);
  padding: 0.45rem 0.7rem;
  font: inherit;
  cursor: pointer;
  color: var(--ink);
}

@media (max-width: 760px) {
  .nav-toggle { display: block; }
  .nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: var(--paper);
    border-bottom: 1px solid var(--line);
    padding: 0.5rem 1rem 1rem;
  }
  .nav.is-open { display: flex; }
  .nav a {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--line);
  }
}

/* —— Disclaimer —— */
.disclaimer {
  background: var(--ink);
  color: #c8ccd4;
  font-size: 0.78rem;
  line-height: 1.5;
  padding: 0.65rem 0;
}

.disclaimer p {
  margin: 0;
  width: min(100% - 2rem, var(--max));
  margin-inline: auto;
}

.disclaimer a {
  color: #e8eaee;
}

.disclaimer--article {
  background: var(--paper-warm);
  color: var(--ink-muted);
  border: 1px solid var(--line);
  border-left: 3px solid var(--cinnabar);
  padding: 0.85rem 1rem;
  margin: 0 0 1.75rem;
  font-size: 0.82rem;
}

.disclaimer--article p { margin: 0; }

/* —— Hero —— */
.hero {
  position: relative;
  min-height: min(88vh, 720px);
  display: flex;
  align-items: flex-end;
  color: #fff;
  overflow: hidden;
  isolation: isolate;
}

.hero__media {
  position: absolute;
  inset: 0;
  z-index: -2;
  background:
    linear-gradient(180deg, rgba(18, 20, 26, 0.25) 0%, rgba(18, 20, 26, 0.72) 55%, rgba(18, 20, 26, 0.92) 100%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='1200' height='800' viewBox='0 0 1200 800'%3E%3Cdefs%3E%3ClinearGradient id='g' x1='0' y1='0' x2='1' y2='1'%3E%3Cstop stop-color='%231a3a45'/%3E%3Cstop offset='.5' stop-color='%232a1f2e'/%3E%3Cstop offset='1' stop-color='%2312141a'/%3E%3C/linearGradient%3E%3C/defs%3E%3Crect fill='url(%23g)' width='1200' height='800'/%3E%3Cpath fill='%231f6b5c' opacity='.25' d='M0 520 Q300 420 600 500 T1200 460 V800 H0Z'/%3E%3Cpath fill='%23c81e1e' opacity='.12' d='M0 600 Q400 520 800 580 T1200 540 V800 H0Z'/%3E%3Ccircle cx='920' cy='160' r='48' fill='%23b0892e' opacity='.35'/%3E%3C/svg%3E") center / cover no-repeat;
  transform: scale(1.04);
  animation: hero-drift 18s var(--ease) infinite alternate;
}

@keyframes hero-drift {
  from { transform: scale(1.04) translate3d(0, 0, 0); }
  to { transform: scale(1.08) translate3d(-1.5%, -1%, 0); }
}

.hero__content {
  width: min(100% - 2rem, var(--max));
  margin-inline: auto;
  padding: 4.5rem 0 3.5rem;
  animation: rise-in 0.9s var(--ease) both;
}

@keyframes rise-in {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}

.hero__brand {
  font-family: var(--font-display);
  font-size: clamp(2.6rem, 7vw, 4.6rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 0.98;
  margin: 0 0 0.55rem;
}

.hero__brand span { color: #ff6b6b; }

.hero__lead {
  max-width: 34ch;
  font-size: clamp(1.05rem, 2vw, 1.25rem);
  color: #d7dbe3;
  margin: 0 0 1.6rem;
}

.hero__cta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

/* —— Buttons —— */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.8rem 1.35rem;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.2s var(--ease), background 0.2s var(--ease), color 0.2s var(--ease);
}

.btn:hover { transform: translateY(-1px); text-decoration: none; }

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

.btn--primary:hover {
  background: var(--cinnabar-deep);
  color: #fff;
}

.btn--ghost {
  background: transparent;
  color: #fff;
  border-color: rgba(255, 255, 255, 0.45);
}

.btn--ghost:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

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

.btn--outline:hover {
  background: var(--ink);
  color: #fff;
}

.btn--affiliate {
  background: var(--jade);
  color: #fff;
  margin: 0.25rem 0 1.25rem;
}

.btn--affiliate:hover {
  background: #185649;
  color: #fff;
}

/* —— Sections —— */
.section {
  padding: 4rem 0;
}

.section__head {
  max-width: 40rem;
  margin-bottom: 2rem;
}

.section__eyebrow {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--cinnabar);
  margin-bottom: 0.5rem;
}

.section__head h2 { margin-top: 0; }
.section__head p {
  color: var(--ink-muted);
  margin: 0;
}

/* —— Article grid —— */
.article-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

.article-card {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 0 0 1.25rem;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
  color: inherit;
  transition: opacity 0.2s var(--ease);
}

.article-card:hover {
  color: inherit;
  opacity: 0.85;
}

.article-card__cat {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--jade);
}

.article-card h3 {
  font-size: 1.2rem;
  margin: 0;
}

.article-card p {
  margin: 0;
  color: var(--ink-muted);
  font-size: 0.95rem;
  flex: 1;
}

.article-card__meta {
  font-size: 0.8rem;
  color: var(--ink-muted);
}

/* —— Category chips —— */
.cat-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 1.25rem;
}

.cat-chip {
  display: inline-block;
  padding: 0.45rem 0.9rem;
  background: var(--jade-soft);
  color: var(--jade);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 560;
}

.cat-chip:hover {
  background: var(--jade);
  color: #fff;
}

/* —— Article layout —— */
.article-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 2.5rem;
  padding: 2.5rem 0 4rem;
  align-items: start;
}

@media (max-width: 900px) {
  .article-layout {
    grid-template-columns: 1fr;
  }
  .sidebar { order: 2; }
}

.article-header {
  margin-bottom: 1.5rem;
}

.article-header__cat {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--jade);
  text-decoration: none;
}

.article-header h1 { margin-top: 0.4rem; }

.article-header__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  color: var(--ink-muted);
  font-size: 0.88rem;
  margin-top: -0.35rem;
}

.prose > *:first-child { margin-top: 0; }

.prose blockquote {
  margin: 1.5rem 0;
  padding: 0.85rem 1.15rem;
  border-left: 3px solid var(--gold);
  background: var(--paper-warm);
  color: var(--ink-soft);
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  margin: 1.25rem 0 1.75rem;
}

.prose th,
.prose td {
  border: 1px solid var(--line);
  padding: 0.65rem 0.75rem;
  text-align: left;
}

.prose th {
  background: var(--paper-warm);
  font-weight: 600;
}

.prose .callout {
  background: var(--jade-soft);
  border: 1px solid rgba(31, 107, 92, 0.2);
  padding: 1rem 1.15rem;
  margin: 1.5rem 0;
}

.prose .callout p:last-child { margin-bottom: 0; }

.affiliate-box {
  border: 1px solid var(--line);
  border-top: 3px solid var(--jade);
  padding: 1.15rem 1.25rem;
  margin: 1.75rem 0;
  background: #fff;
  box-shadow: var(--shadow-soft);
}

.affiliate-box h3 {
  margin-top: 0;
  font-size: 1.1rem;
}

.affiliate-box p {
  font-size: 0.95rem;
  color: var(--ink-soft);
}

.affiliate-note {
  font-size: 0.78rem;
  color: var(--ink-muted);
  margin: 0.5rem 0 0;
}

/* —— Sidebar —— */
.sidebar {
  position: sticky;
  top: 5.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.sidebar__block h3 {
  font-size: 0.95rem;
  margin: 0 0 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--line);
}

.sidebar__links {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sidebar__links li {
  margin-bottom: 0.55rem;
}

.sidebar__links a {
  text-decoration: none;
  font-size: 0.92rem;
  color: var(--ink-soft);
}

.sidebar__links a:hover { color: var(--cinnabar); }

/* —— Ad slots (hidden until JOY_ADS.enabled) —— */
.ad-slot,
.ad-slot--dormant,
.ad-rail--dormant[hidden] {
  display: none;
}

.ad-slot[data-ad-loaded="true"] {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--ad-bg);
  border: 1px solid var(--line);
  min-height: 90px;
  width: 100%;
  overflow: hidden;
}

.ad-slot--sidebar[data-ad-loaded="true"] { min-height: 250px; }
.ad-slot--in-article[data-ad-loaded="true"] { min-height: 120px; margin: 2rem 0; }

.ad-rail {
  width: min(100% - 2rem, var(--max));
  margin: 1rem auto;
}

/* —— Task cards / hub paths —— */
.task-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin: 1.5rem 0 0;
}

@media (max-width: 800px) {
  .task-grid { grid-template-columns: 1fr; }
}

.task-card {
  display: block;
  padding: 1.15rem 1.2rem;
  background: #fff;
  border: 1px solid var(--line);
  border-top: 3px solid var(--jade);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.2s var(--ease);
}

.task-card:hover {
  color: inherit;
  border-color: var(--cinnabar);
}

.task-card__label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--cinnabar);
  margin-bottom: 0.35rem;
}

.task-card h3 {
  margin: 0 0 0.4rem;
  font-size: 1.15rem;
}

.task-card p {
  margin: 0;
  color: var(--ink-muted);
  font-size: 0.92rem;
}

.start-here {
  background: var(--jade-soft);
  border: 1px solid rgba(31, 107, 92, 0.2);
  padding: 1.1rem 1.25rem;
  margin: 0 0 1.75rem;
}

.start-here h2 {
  margin: 0 0 0.55rem;
  font-size: 1.1rem;
}

.start-here ol {
  margin: 0;
  padding-left: 1.2em;
}

.start-here li { margin-bottom: 0.35rem; }

.intent-note {
  font-size: 0.88rem;
  color: var(--ink-muted);
  border-left: 3px solid var(--gold);
  padding: 0.65rem 0.9rem;
  background: var(--paper-warm);
  margin: 0 0 1.5rem;
}

/* —— Page hero (inner) —— */
.page-hero {
  padding: 3rem 0 1.5rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 0;
}

.page-hero h1 { margin-bottom: 0.4rem; }
.page-hero p {
  max-width: 42rem;
  color: var(--ink-muted);
  margin: 0;
}

/* —— Footer —— */
.site-footer {
  background: var(--ink);
  color: #aeb4c0;
  padding: 3rem 0 2rem;
  margin-top: 2rem;
}

.site-footer a {
  color: #d8dce4;
  text-decoration: none;
}

.site-footer a:hover { color: #fff; }

.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 2rem;
  margin-bottom: 2rem;
}

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

.footer-brand {
  font-family: var(--font-display);
  font-size: 1.35rem;
  color: #fff;
  margin: 0 0 0.5rem;
}

.footer-brand span { color: #ff6b6b; }

.footer-col h4 {
  color: #fff;
  font-family: var(--font-body);
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin: 0 0 0.85rem;
}

.footer-col ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-col li { margin-bottom: 0.45rem; }

.footer-disclaimer {
  border-top: 1px solid #2e3340;
  padding-top: 1.25rem;
  font-size: 0.78rem;
  line-height: 1.55;
}

.footer-disclaimer p { margin: 0 0 0.75rem; }

.footer-copy {
  font-size: 0.78rem;
  color: #7d8494;
  margin: 0;
}

/* —— Related —— */
.related {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--line);
}

.related h2 {
  font-size: 1.35rem;
  margin-top: 0;
}

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

.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}

.reveal.is-visible {
  opacity: 1;
  transform: none;
}

/* —— GEO / extractable content —— */
.key-answer {
  background: #fff;
  border: 1px solid var(--line);
  border-left: 4px solid var(--jade);
  padding: 1rem 1.15rem;
  margin: 0 0 1.75rem;
  box-shadow: var(--shadow-soft);
}

.key-answer p { margin: 0; color: var(--ink-soft); }

.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.5rem;
  font-size: 0.82rem;
  color: var(--ink-muted);
  margin: 0 0 1rem;
}

.breadcrumbs a {
  color: var(--ink-muted);
  text-decoration: none;
}

.breadcrumbs a:hover { color: var(--cinnabar); }

.sources {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
}

.sources h2 { font-size: 1.2rem; margin-top: 0; }

.sources-note {
  font-size: 0.85rem;
  color: var(--ink-muted);
}

.prose .faq-anchor {
  scroll-margin-top: 5rem;
}
