/* ==========================================================================
   xuexizhongwen.de — modern design system (Step 4, 2026-09-01)
   One stylesheet for the whole site. Vanilla CSS, zero dependencies,
   no build step. Mobile-first. Follows the dev-nightshift web-dev-standard.
   ========================================================================== */

/* ---- tokens ----------------------------------------------------------- */
:root {
  /* color */
  --ink: #1f2430;
  --ink-soft: #454c5c;
  --paper: #ffffff;
  --paper-soft: #f5f6f8;
  --line: #e2e5ea;
  --accent: #a8251d;        /* chinese red */
  --accent-strong: #8e1d16;
  --accent-soft: #faf0ef;
  --gold: #b8860b;
  --ok: #1e7d46;
  --warn: #9a5b00;

  /* type scale (fluid) */
  --text-xs: 0.8125rem;
  --text-sm: 0.9rem;
  --text-base: clamp(1rem, 0.97rem + 0.15vw, 1.0625rem);
  --text-lg: clamp(1.15rem, 1.05rem + 0.5vw, 1.35rem);
  --text-xl: clamp(1.4rem, 1.2rem + 1vw, 1.75rem);
  --text-2xl: clamp(1.75rem, 1.4rem + 1.75vw, 2.4rem);

  /* spacing scale */
  --s1: 0.25rem;
  --s2: 0.5rem;
  --s3: 0.75rem;
  --s4: 1rem;
  --s5: 1.5rem;
  --s6: 2rem;
  --s7: 3rem;
  --s8: 4rem;

  /* layout */
  --measure: 65ch;           /* comfortable reading width */
  --container: 68rem;
  --header-h: 4rem;
  --radius: 0.375rem;

  /* z-index token scale — never 9999 */
  --z-base: 0;
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-overlay: 300;
  --z-modal: 400;

  /* motion */
  --dur: 180ms;
  --ease: ease-out;

  /* legacy bootstrap-compat grid (page bodies still use these) */
  --gutter: 1rem;
}

/* ---- reset (kept intentionally small) --------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { line-height: 1.6; }
img, picture, video, canvas, svg { display: block; max-width: 100%; height: auto; }
input, button, textarea, select { font: inherit; color: inherit; }
h1, h2, h3, h4 { text-wrap: balance; line-height: 1.25; overflow-wrap: break-word; }
p, li { text-wrap: pretty; overflow-wrap: break-word; }

/* ---- base -------------------------------------------------------------- */
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: var(--text-base);
  color: var(--ink);
  background: var(--paper-soft);
}

a { color: var(--accent-strong); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--accent); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

h1 { font-size: var(--text-2xl); margin-block: var(--s5) var(--s3); }
h2 { font-size: var(--text-xl); margin-block: var(--s6) var(--s3); }
h3 { font-size: var(--text-lg); margin-block: var(--s5) var(--s2); }
h4 { font-size: var(--text-base); margin-block: var(--s4) var(--s1); }
p { margin-block: var(--s3); }
ul, ol { padding-inline-start: 1.4em; margin-block: var(--s3); }
li { margin-block: var(--s1); }

/* ---- layout ------------------------------------------------------------ */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--s4);
}
/* legacy compat: bootstrap's container-fluid behaved as a full-width wrapper */
.container-fluid { width: 100%; padding-inline: var(--s4); }
.row { display: flex; flex-wrap: wrap; gap: var(--gutter); margin-inline: 0; }

.skip-link {
  position: absolute;
  inset-inline-start: var(--s3);
  top: -100px;
  z-index: var(--z-modal);
  background: var(--ink);
  color: #fff;
  padding: var(--s2) var(--s4);
  border-radius: 0 0 var(--radius) var(--radius);
  transition: top var(--dur) var(--ease);
}
.skip-link:focus { top: 0; }

/* ---- header ------------------------------------------------------------ */
.site-header {
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
}
.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s4);
  min-height: var(--header-h);
  padding-block: var(--s2);
}
.site-brand {
  display: flex;
  align-items: center;
  gap: var(--s3);
  text-decoration: none;
  color: var(--ink);
  min-width: 0;
}
.site-brand img { width: auto; height: 2.4rem; }
.site-brand__text { display: grid; line-height: 1.15; }
.site-brand__title { font-size: var(--text-lg); font-weight: 700; }
.site-brand__sub { font-size: var(--text-xs); color: var(--ink-soft); }

/* ---- nav --------------------------------------------------------------- */
.site-nav { background: var(--paper); }
.site-nav__list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  padding: 0;
  margin: 0;
}
.site-nav__list li { margin: 0; }
.site-nav__list a {
  display: block;
  padding: var(--s3) var(--s4);
  color: var(--ink);
  text-decoration: none;
  border-bottom: 3px solid transparent;
  font-weight: 500;
}
.site-nav__list a:hover { color: var(--accent-strong); background: var(--paper-soft); }
.site-nav__list a[aria-current="page"], .site-nav__list a.is-active {
  border-bottom-color: var(--accent);
  color: var(--accent-strong);
}

/* mobile nav toggle — checkbox hack, no JS required */
.nav-toggle { display: none; }
.nav-toggle-label {
  display: none;
  cursor: pointer;
  padding: var(--s2) var(--s3);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-weight: 600;
  user-select: none;
}

/* ---- main / content grid ----------------------------------------------- */
.site-main { padding-block: var(--s5) var(--s8); }
.content-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--s6);
  align-items: start;
}
.content-main { min-width: 0; }
.content-side { min-width: 0; }

/* ---- footer ------------------------------------------------------------ */
.site-footer {
  background: var(--ink);
  color: #cfd3dc;
  padding-block: var(--s7) var(--s5);
  margin-top: var(--s8);
}
.site-footer a { color: #cfd3dc; }
.site-footer a:hover { color: #fff; }
.site-footer__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--s6);
}
.site-footer h2, .site-footer h3, .site-footer h4 { color: #fff; }
.site-footer .copyright { margin-top: var(--s6); font-size: var(--text-sm); color: #9aa1ad; }

/* ---- content typography / articles ------------------------------------- */
.article { max-width: var(--measure); }
.article p, .article li { line-height: 1.75; }
.article h2, .article h3 { scroll-margin-top: calc(var(--header-h) + var(--s4)); }

/* legacy: old pages rendered headings inside .wb/.contentbody wrappers */
.contentbody h1, .wb h1 { font-size: var(--text-xl); }
.contentbody h2, .wb h2 { font-size: var(--text-lg); }
.contentbody h3, .wb h3 { font-size: var(--text-base); }

/* ---- components -------------------------------------------------------- */
.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--s5);
}
.card + .card { margin-top: var(--s4); }
.card h3 { margin-top: 0; }
.card-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--s4);
  margin-block: var(--s4);
}
@media (min-width: 40rem) {
  .card-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 64rem) {
  .card-grid { grid-template-columns: repeat(3, 1fr); }
}

/* hero */
.hero { padding-block: var(--s6) var(--s4); }
.hero h1 { margin-top: 0; }
.hero__lead {
  font-size: var(--text-lg);
  color: var(--ink-soft);
  max-width: 45rem;
  margin-top: var(--s3);
}

/* link list (homepage featured) */
.link-list { list-style: none; padding: 0; }
.link-list li { padding-block: var(--s2); border-bottom: 1px solid var(--line); }
.link-list li:last-child { border-bottom: 0; }

/* buttons */
.btn {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  padding: var(--s2) var(--s4);
  border-radius: var(--radius);
  text-decoration: none;
  font-weight: 600;
  border: 0;
  cursor: pointer;
}
.btn:hover { background: var(--accent-strong); color: #fff; }
.btn--ghost { background: transparent; color: var(--accent-strong); border: 1px solid var(--accent); }
.btn--ghost:hover { background: var(--accent-soft); }

/* tables */
table { border-collapse: collapse; width: 100%; margin-block: var(--s4); font-size: var(--text-sm); }
th, td { border: 1px solid var(--line); padding: var(--s2) var(--s3); text-align: start; vertical-align: top; }
th { background: var(--paper-soft); font-weight: 600; }

blockquote {
  border-inline-start: 4px solid var(--accent);
  padding-inline-start: var(--s4);
  color: var(--ink-soft);
  font-style: italic;
  margin-block: var(--s4);
}

hr { border: 0; border-top: 1px solid var(--line); margin-block: var(--s6); }

/* legacy helpers the old pages rely on */
img.img-responsive, .img-responsive { max-width: 100%; height: auto; }
img.rounded { border-radius: var(--radius); }
.center, .text-center { text-align: center; }
.clearfix::after { content: ""; display: table; clear: both; }

/* ---- forms ------------------------------------------------------------- */
label { font-weight: 600; }
input[type="text"], input[type="email"], input[type="search"], textarea, select {
  width: 100%;
  max-width: 32rem;
  padding: var(--s2) var(--s3);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
}
input:user-invalid, textarea:user-invalid { border-color: var(--warn); }

/* ---- responsive -------------------------------------------------------- */
@media (min-width: 48rem) { /* 768px */
  .content-grid { grid-template-columns: minmax(0, 1fr) 18rem; }
  .site-footer__grid { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 64rem) { /* 1024px */
  .content-grid { grid-template-columns: minmax(0, 1fr) 20rem; }
}

/* legacy bootstrap grid compat — page bodies use col-sm-* / col-xs-* */
@media (min-width: 48rem) {
  .col-sm-1 { flex: 0 0 calc(8.3333% - var(--gutter)); }
  .col-sm-2 { flex: 0 0 calc(16.6667% - var(--gutter)); }
  .col-sm-3 { flex: 0 0 calc(25% - var(--gutter)); }
  .col-sm-4 { flex: 0 0 calc(33.3333% - var(--gutter)); }
  .col-sm-5 { flex: 0 0 calc(41.6667% - var(--gutter)); }
  .col-sm-6 { flex: 0 0 calc(50% - var(--gutter)); }
  .col-sm-7 { flex: 0 0 calc(58.3333% - var(--gutter)); }
  .col-sm-8 { flex: 0 0 calc(66.6667% - var(--gutter)); }
  .col-sm-9 { flex: 0 0 calc(75% - var(--gutter)); }
  .col-sm-10 { flex: 0 0 calc(83.3333% - var(--gutter)); }
  .col-sm-11 { flex: 0 0 calc(91.6667% - var(--gutter)); }
  .col-sm-12 { flex: 0 0 calc(100% - var(--gutter)); }
}
@media (max-width: 47.99rem) {
  .col-xs-6 { flex: 0 0 calc(50% - var(--gutter)); }
  .col-xs-12 { flex: 0 0 calc(100% - var(--gutter)); }
}

/* ---- mobile nav behaviour (no JS) -------------------------------------- */
@media (max-width: 47.99rem) {
  .nav-toggle-label { display: inline-block; }
  .site-nav { display: none; width: 100%; }
  .site-nav__list { flex-direction: column; }
  .site-header__inner { flex-wrap: wrap; }
  .nav-toggle:checked ~ .site-nav { display: block; }
}

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

/* ---- print ------------------------------------------------------------- */
@media print {
  .site-header, .site-nav, .site-footer, .content-side, .ad-banner { display: none !important; }
  body { background: #fff; color: #000; }
  .site-main { padding: 0; }
}

/* ---- utilities --------------------------------------------------------- */
.mt-0 { margin-top: 0; } .mb-0 { margin-bottom: 0; }
.mt-1 { margin-top: var(--s4); } .mb-1 { margin-bottom: var(--s4); }
.mt-2 { margin-top: var(--s5); } .mb-2 { margin-bottom: var(--s5); }
.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;
}

/* ---- legacy content compat (template-family pages, step-4 fallback) -----
   The ~42 assets/template pages carry WordPress-era content scaffolding
   (single-ss, sub_block, imgbord, tac, …). Step 5 rewrites their content;
   until then these rules keep them readable under the new design. */
.tac { text-align: center; }
.imgbord { border: 1px solid var(--line); border-radius: var(--radius); }
img.size-full, img.wp-image-525, img.wp-image-1225 { max-width: 100%; height: auto; }
.single-ss { margin-block: var(--s3); }
.sub_block { margin-block: var(--s5); }
.three_blocks { display: flex; flex-wrap: wrap; gap: var(--s4); margin-block: var(--s4); }
.three_blocks > * { flex: 1 1 14rem; }
.img-top, .img2 { max-width: 100%; height: auto; }
.alignright { float: right; margin: 0 0 var(--s3) var(--s4); }
.alignleft { float: left; margin: 0 var(--s4) var(--s3) 0; }
.alignnone { max-width: 100%; height: auto; margin-block: var(--s3); }
.clear { clear: both; }
.subpage-title-section, .banner-section { padding-block: var(--s3); }
.subpage-title h1 { margin-block: var(--s4) var(--s2); }
.sponsored-section { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--s4); margin-block: var(--s4); }
.ad, .advertise, .h-ad { font-size: var(--text-xs); color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.05em; }
.green { color: var(--ok); }
.blue { color: #1e5ea8; }
.genmed { font-size: var(--text-sm); }
/* wordpress legacy */
.wp-caption { max-width: 100%; }
.wp-smiley { display: inline; }
.yback { background: var(--paper-soft); padding: var(--s3); border-radius: var(--radius); }

