/* =========================================================
   芝加哥新移民安居融入指南 — 冷峻都市 / 湖岸工业风
   ========================================================= */

:root {
  --bg: #eef2f5;
  --bg-soft: #f9fbfc;
  --ink: #1a2430;
  --ink-muted: #4e5b6a;
  --ink-faint: #7a8795;
  --line: #d5dee6;
  --line-strong: #b8c5d1;

  /* 密歇根湖蓝 / 旗帜浅蓝 / 钢城砖红 */
  --lake: #0b5f8a;
  --lake-deep: #074362;
  --sky: #2a9fd6;
  --sky-soft: #e3f3fb;
  --brick: #a63d2f;
  --brick-soft: #f7ebe8;
  --steel: #3d5a6c;
  --slate: #243444;
  --slate-deep: #15202c;
  --moss: #3d6b55;
  --moss-soft: #e8f1ec;
  --sun: #c9a227;
  --sun-soft: #faf5e3;

  --sidebar-w: 300px;
  --content-max: 900px;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 8px 28px rgba(26, 36, 48, 0.07);
  --shadow-soft: 0 3px 14px rgba(26, 36, 48, 0.05);

  --font-body: "Charter", "Bitstream Charter", "Iowan Old Style", Palatino, Georgia, "Songti SC", "Noto Serif CJK SC", serif;
  --font-ui: "Segoe UI", system-ui, -apple-system, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-display: "Segoe UI", "PingFang SC", "Hiragino Sans GB", system-ui, sans-serif;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.85;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--lake);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

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

/* 侧栏：更深钢青，偏城市夜景 */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: linear-gradient(180deg, #0f1720 0%, #1a2a38 45%, #12202e 100%);
  color: #eef5fa;
  display: flex;
  flex-direction: column;
  z-index: 100;
  box-shadow: 10px 0 36px rgba(10, 16, 24, 0.22);
  overflow: hidden;
}

.sidebar::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(135deg, rgba(42, 159, 214, 0.08), transparent 40%),
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 47px,
      rgba(255, 255, 255, 0.02) 48px
    );
  pointer-events: none;
}

.sidebar-brand {
  position: relative;
  padding: 26px 22px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-brand .kicker {
  display: block;
  font-family: var(--font-ui);
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #7ec8ef;
  margin-bottom: 10px;
}

.sidebar-brand h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 700;
  line-height: 1.35;
}

.sidebar-brand p {
  margin: 8px 0 0;
  font-family: var(--font-ui);
  font-size: 12px;
  line-height: 1.5;
  color: rgba(238, 245, 250, 0.62);
}

.sidebar-nav {
  position: relative;
  flex: 1;
  overflow-y: auto;
  padding: 12px 10px 24px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.16) transparent;
}

.sidebar-nav::-webkit-scrollbar {
  width: 5px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.14);
  border-radius: 999px;
}

.nav-part {
  margin-bottom: 6px;
}

.nav-part-title {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: 0;
  background: transparent;
  color: #fff;
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 650;
  text-align: left;
  padding: 11px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.nav-part-title:hover {
  background: rgba(255, 255, 255, 0.06);
}

.nav-part-title .part-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 4px;
  background: rgba(42, 159, 214, 0.22);
  color: #9fd9f5;
  font-size: 11px;
  flex-shrink: 0;
  font-weight: 700;
}

.nav-part-title .chev {
  margin-left: auto;
  opacity: 0.5;
  font-size: 11px;
  transition: transform 0.2s ease;
}

.nav-part.open .nav-part-title .chev {
  transform: rotate(90deg);
}

.nav-sub {
  display: none;
  list-style: none;
  margin: 2px 0 8px 26px;
  padding: 0;
}

.nav-part.open .nav-sub {
  display: block;
}

.nav-sub a {
  display: block;
  color: rgba(238, 245, 250, 0.68);
  font-family: var(--font-ui);
  font-size: 12.5px;
  line-height: 1.4;
  text-decoration: none;
  padding: 8px 10px 8px 12px;
  border-left: 2px solid transparent;
  border-radius: 0 6px 6px 0;
  transition: all 0.18s ease;
}

.nav-sub a:hover,
.nav-sub a.active {
  color: #fff;
  background: rgba(42, 159, 214, 0.1);
  border-left-color: #7ec8ef;
}

.sidebar-footer {
  position: relative;
  padding: 12px 18px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-family: var(--font-ui);
  font-size: 11px;
  color: rgba(238, 245, 250, 0.4);
  line-height: 1.5;
}

.main-content {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
}

.mobile-bar {
  display: none;
  position: sticky;
  top: 0;
  z-index: 90;
  background: rgba(15, 23, 32, 0.96);
  backdrop-filter: blur(10px);
  color: #fff;
  padding: 12px 16px;
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 600;
}

.mobile-bar button {
  border: 0;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border-radius: 6px;
  padding: 8px 12px;
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
}

.page {
  max-width: calc(var(--content-max) + 96px);
  margin: 0 auto;
  padding: 32px 48px 120px;
}

/* 封面：湖蓝 + 砖红几何 */
.cover {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  padding: 52px 44px 44px;
  background:
    linear-gradient(115deg, rgba(11, 95, 138, 0.12) 0%, transparent 42%),
    linear-gradient(320deg, rgba(166, 61, 47, 0.1) 0%, transparent 38%),
    linear-gradient(160deg, #f9fbfc 0%, #e8eef3 55%, #dfe7ee 100%);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  margin-bottom: 32px;
}

.cover::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 180px;
  height: 180px;
  background:
    linear-gradient(90deg, transparent 48%, rgba(42, 159, 214, 0.15) 48%, rgba(42, 159, 214, 0.15) 52%, transparent 52%),
    linear-gradient(0deg, transparent 48%, rgba(42, 159, 214, 0.15) 48%, rgba(42, 159, 214, 0.15) 52%, transparent 52%);
  background-size: 28px 28px;
  opacity: 0.7;
  pointer-events: none;
}

.cover-inner {
  position: relative;
  z-index: 1;
}

.cover .eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-ui);
  font-size: 11.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--brick);
  font-weight: 700;
  margin-bottom: 16px;
}

.cover .eyebrow::before {
  content: "";
  width: 8px;
  height: 8px;
  background: var(--sky);
  transform: rotate(45deg);
}

.cover h2 {
  margin: 0 0 14px;
  font-family: var(--font-display);
  font-size: clamp(30px, 4vw, 46px);
  line-height: 1.18;
  font-weight: 750;
  letter-spacing: -0.025em;
  color: var(--slate-deep);
}

.cover .subtitle {
  margin: 0 0 24px;
  max-width: 36em;
  font-size: 17.5px;
  line-height: 1.75;
  color: var(--ink-muted);
}

.cover-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.cover-meta span {
  font-family: var(--font-ui);
  font-size: 12px;
  padding: 7px 11px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid var(--line-strong);
  color: var(--ink-muted);
}

.intro {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-left: 4px solid var(--lake);
  border-radius: var(--radius);
  padding: 28px 32px;
  margin-bottom: 44px;
  box-shadow: var(--shadow-soft);
}

.intro h3 {
  margin: 0 0 12px;
  font-family: var(--font-display);
  font-size: 21px;
  color: var(--ink);
}

.intro p {
  margin: 0 0 12px;
  color: var(--ink-muted);
}

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

.part-banner {
  margin: 64px 0 24px;
  padding: 24px 28px;
  border-radius: var(--radius);
  background: linear-gradient(120deg, #15202c 0%, #1c3348 55%, #0b5f8a 100%);
  color: #fff;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.part-banner::after {
  content: "";
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  width: 72px;
  height: 72px;
  border: 2px solid rgba(255, 255, 255, 0.12);
  border-radius: 50%;
}

.part-banner .part-num {
  font-family: var(--font-ui);
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #8fd0f0;
  margin-bottom: 6px;
}

.part-banner h2 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: clamp(22px, 2.8vw, 30px);
  font-weight: 700;
  line-height: 1.3;
}

.part-banner p {
  margin: 0;
  color: rgba(255, 255, 255, 0.78);
  max-width: 46em;
  font-size: 15px;
}

section.chapter {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 32px 36px 38px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-soft);
  scroll-margin-top: 20px;
}

section.chapter h3 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 720;
  letter-spacing: -0.015em;
  color: var(--slate-deep);
  scroll-margin-top: 20px;
}

section.chapter .lead {
  margin: 0 0 22px;
  color: var(--ink-muted);
  font-size: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

section.chapter h4 {
  margin: 30px 0 12px;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: var(--lake-deep);
  scroll-margin-top: 20px;
}

section.chapter h5 {
  margin: 22px 0 10px;
  font-family: var(--font-ui);
  font-size: 15px;
  font-weight: 700;
  color: var(--steel);
}

section.chapter p {
  margin: 0 0 15px;
}

section.chapter ul,
section.chapter ol {
  margin: 0 0 16px;
  padding-left: 1.3em;
}

section.chapter li {
  margin-bottom: 7px;
}

section.chapter li::marker {
  color: var(--lake);
}

.chapter-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 18px 0 22px;
}

.mini-card {
  background: #fff;
  border: 1px solid var(--line);
  border-top: 3px solid var(--sky);
  border-radius: var(--radius-sm);
  padding: 16px 16px 14px;
}

.mini-card h6 {
  margin: 0 0 8px;
  font-family: var(--font-ui);
  font-size: 12.5px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--lake);
}

.mini-card p {
  margin: 0;
  font-size: 14.5px;
  color: var(--ink-muted);
}

.alert-box {
  margin: 20px 0;
  padding: 16px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  border-left-width: 4px;
}

.alert-box .alert-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 8px;
}

.alert-box p,
.alert-box li {
  font-size: 15px;
}

.alert-box p:last-child,
.alert-box ul:last-child,
.alert-box ol:last-child {
  margin-bottom: 0;
}

.alert-box.concept {
  background: var(--sky-soft);
  border-color: #b8dff2;
  border-left-color: var(--lake);
  color: #0a3d58;
}

.alert-box.concept .alert-title {
  color: var(--lake);
}

.alert-box.warn {
  background: var(--brick-soft);
  border-color: #e8c4bc;
  border-left-color: var(--brick);
  color: #5c241c;
}

.alert-box.warn .alert-title {
  color: var(--brick);
}

.alert-box.tip {
  background: var(--moss-soft);
  border-color: #c5dbcf;
  border-left-color: var(--moss);
  color: #1f4634;
}

.alert-box.tip .alert-title {
  color: var(--moss);
}

.alert-box.star {
  background: var(--sun-soft);
  border-color: #ecd9a0;
  border-left-color: var(--sun);
  color: #5c4810;
}

.alert-box.star .alert-title {
  color: #8a6d10;
}

.table-wrap {
  margin: 18px 0 24px;
  overflow-x: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: #fff;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-ui);
  font-size: 13.5px;
  line-height: 1.5;
}

thead th {
  background: var(--slate);
  color: #fff;
  text-align: left;
  padding: 11px 13px;
  font-weight: 650;
  white-space: nowrap;
}

tbody td {
  padding: 11px 13px;
  border-top: 1px solid var(--line);
  color: var(--ink-muted);
  vertical-align: top;
}

tbody tr:nth-child(even) {
  background: #f4f7f9;
}

tbody tr:hover {
  background: #e9f1f7;
}

.timeline {
  position: relative;
  margin: 26px 0 12px;
  padding-left: 26px;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 7px;
  top: 4px;
  bottom: 4px;
  width: 2px;
  background: linear-gradient(180deg, var(--sky), var(--lake), var(--steel));
  border-radius: 999px;
}

.timeline-item {
  position: relative;
  margin-bottom: 20px;
  padding: 16px 18px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: -22px;
  top: 24px;
  width: 10px;
  height: 10px;
  background: var(--sky);
  transform: rotate(45deg);
}

.timeline-item .t-label {
  font-family: var(--font-ui);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--lake);
  margin-bottom: 6px;
}

.timeline-item h5 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: 16.5px;
  color: var(--ink);
}

.timeline-item p {
  margin: 0;
  color: var(--ink-muted);
  font-size: 14.5px;
}

.steps {
  counter-reset: step;
  list-style: none;
  margin: 16px 0 22px;
  padding: 0;
}

.steps li {
  counter-increment: step;
  position: relative;
  padding: 13px 14px 13px 54px;
  margin-bottom: 10px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.steps li::before {
  content: counter(step);
  position: absolute;
  left: 12px;
  top: 13px;
  width: 28px;
  height: 28px;
  background: var(--lake);
  color: #fff;
  font-family: var(--font-ui);
  font-size: 12.5px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 2px;
}

.key {
  display: inline;
  padding: 0.05em 0.35em;
  border-radius: 3px;
  background: rgba(11, 95, 138, 0.08);
  color: var(--lake);
  font-weight: 650;
  font-family: var(--font-ui);
  font-size: 0.92em;
}

.redline {
  color: var(--brick);
  font-weight: 700;
}

.checklist {
  list-style: none;
  padding-left: 0;
}

.checklist li {
  position: relative;
  padding-left: 26px;
}

.checklist li::before {
  content: "□";
  position: absolute;
  left: 0;
  top: 0;
  color: var(--lake);
  font-size: 16px;
  font-weight: 700;
}

.page-end {
  margin-top: 48px;
  padding: 20px 0 0;
  border-top: 1px solid var(--line);
  color: var(--ink-faint);
  font-family: var(--font-ui);
  font-size: 12.5px;
  text-align: center;
}

.back-top {
  display: inline-block;
  margin-bottom: 20px;
  font-family: var(--font-ui);
  font-size: 13px;
  color: var(--ink-muted);
  text-decoration: none;
}

.back-top:hover {
  color: var(--lake);
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(10, 16, 24, 0.45);
  z-index: 95;
}

.sidebar-overlay.show {
  display: block;
}

@media (max-width: 980px) {
  .page {
    padding: 24px 24px 96px;
  }

  section.chapter,
  .intro,
  .cover {
    padding-left: 22px;
    padding-right: 22px;
  }

  .chapter-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s ease;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
  }

  .mobile-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
  }

  .page {
    padding: 16px 14px 80px;
  }

  .cover {
    padding: 28px 18px 24px;
    border-radius: 12px;
  }

  section.chapter {
    padding: 22px 16px 26px;
  }

  body {
    font-size: 16px;
  }
}
