/* ============================================================
   意大利头条 · toutiao.hao0039.com
   设计语言：暖纸底色 + 意大利三色克制点缀 + 中文编辑排版
   ============================================================ */

:root {
  --bg: #faf9f7;
  --surface: #ffffff;
  --surface2: #f3f1ec;
  --text: #191817;
  --muted: #6f6b64;
  --border: #e7e3dc;
  --accent: #008c45;
  --accent-soft: rgba(0, 140, 69, 0.09);
  --red: #cd212a;
  --shadow: 0 1px 2px rgba(25, 24, 23, 0.04), 0 8px 24px -12px rgba(25, 24, 23, 0.12);
  --shadow-lift: 0 2px 4px rgba(25, 24, 23, 0.05), 0 16px 32px -12px rgba(25, 24, 23, 0.18);
  --radius: 14px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101216;
    --surface: #181b21;
    --surface2: #1f232b;
    --text: #e9e7e3;
    --muted: #9b978f;
    --border: #2a2e37;
    --accent: #2fb673;
    --accent-soft: rgba(47, 182, 115, 0.12);
    --red: #e5484d;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px -12px rgba(0, 0, 0, 0.5);
    --shadow-lift: 0 2px 4px rgba(0, 0, 0, 0.35), 0 16px 32px -12px rgba(0, 0, 0, 0.6);
    color-scheme: dark;
  }
}

:root[data-theme="light"] {
  --bg: #faf9f7;
  --surface: #ffffff;
  --surface2: #f3f1ec;
  --text: #191817;
  --muted: #6f6b64;
  --border: #e7e3dc;
  --accent: #008c45;
  --accent-soft: rgba(0, 140, 69, 0.09);
  --red: #cd212a;
  --shadow: 0 1px 2px rgba(25, 24, 23, 0.04), 0 8px 24px -12px rgba(25, 24, 23, 0.12);
  --shadow-lift: 0 2px 4px rgba(25, 24, 23, 0.05), 0 16px 32px -12px rgba(25, 24, 23, 0.18);
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #101216;
  --surface: #181b21;
  --surface2: #1f232b;
  --text: #e9e7e3;
  --muted: #9b978f;
  --border: #2a2e37;
  --accent: #2fb673;
  --accent-soft: rgba(47, 182, 115, 0.12);
  --red: #e5484d;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px -12px rgba(0, 0, 0, 0.5);
  --shadow-lift: 0 2px 4px rgba(0, 0, 0, 0.35), 0 16px 32px -12px rgba(0, 0, 0, 0.6);
  color-scheme: dark;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.75;
  transition: background 0.25s ease, color 0.25s ease;
}

a { color: inherit; text-decoration: none; }
a:focus-visible, button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 20px; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.topbar-in {
  display: flex;
  align-items: center;
  gap: 22px;
  height: 60px;
}

.brand { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

.brand-badge {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: linear-gradient(135deg, #009a4d, #006b35);
  color: #fff;
  font-weight: 700;
  font-size: 16px;
  box-shadow: inset 0 -6px 12px rgba(0, 0, 0, 0.18);
}

.brand-name {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.nav {
  display: flex;
  gap: 2px;
  overflow-x: auto;
  scrollbar-width: none;
  flex: 1;
}
.nav::-webkit-scrollbar { display: none; }

.nav a {
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 14.5px;
  color: var(--muted);
  white-space: nowrap;
  transition: color 0.15s, background 0.15s;
}
.nav a:hover { color: var(--text); background: var(--surface2); }
.nav a.on { color: var(--accent); background: var(--accent-soft); font-weight: 600; }

.topbar-right { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }

.today { font-size: 13px; color: var(--muted); white-space: nowrap; }

#theme-toggle {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
#theme-toggle:hover { color: var(--text); border-color: var(--muted); }
.i-moon { display: none; }
:root[data-theme="dark"] .i-sun { display: none; }
:root[data-theme="dark"] .i-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .i-sun { display: none; }
  :root:not([data-theme="light"]) .i-moon { display: block; }
}

/* ---------- 通用元素 ---------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 12px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--chip, var(--accent)) 10%, transparent);
  color: color-mix(in srgb, var(--chip, var(--accent)) 82%, var(--text));
  font-size: 13px;
  font-weight: 600;
  transition: background 0.15s;
}
.chip:hover { background: color-mix(in srgb, var(--chip, var(--accent)) 18%, transparent); }
.chip i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--chip, var(--accent));
}
.chip-sm { padding: 3px 10px; font-size: 12px; }

.meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}
.meta i { font-style: normal; opacity: 0.55; }
.meta .src { font-weight: 600; }

/* ---------- 首页英雄区 ---------- */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.9fr) minmax(0, 1fr);
  gap: 22px;
  padding: 34px 0 10px;
}

.hero-main {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 14px;
  padding: 30px 34px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 4px);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.hero-main::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: linear-gradient(180deg, #008c45 33%, #f4f5f0 33% 66%, #cd212a 66%);
  opacity: 0.9;
}

.hero-main h1 {
  font-size: clamp(1.45rem, 3.2vw, 2.05rem);
  line-height: 1.4;
  font-weight: 700;
  letter-spacing: 0.01em;
}
.hero-main h1 a:hover { color: var(--accent); }

.hero-main .dek {
  font-size: 15.5px;
  color: var(--muted);
  line-height: 1.8;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.hero-side {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 4px);
  padding: 22px 24px;
  box-shadow: var(--shadow);
}

.hero-side h2 {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.latest { list-style: none; counter-reset: n; }
.latest li {
  counter-increment: n;
  display: grid;
  grid-template-columns: 22px 1fr;
  grid-template-rows: auto auto;
  column-gap: 10px;
  padding: 9px 0;
  border-bottom: 1px dashed var(--border);
}
.latest li:last-child { border-bottom: 0; padding-bottom: 0; }
.latest li::before {
  content: counter(n);
  grid-row: 1 / 3;
  font-size: 13px;
  font-weight: 700;
  color: var(--border);
  font-variant-numeric: tabular-nums;
  line-height: 1.65;
}
.latest li:nth-child(-n + 3)::before { color: var(--red); }
.latest a {
  font-size: 14.5px;
  line-height: 1.65;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.latest a:hover { color: var(--accent); }
.latest .t { grid-column: 2; font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ---------- 栏目区块与卡片 ---------- */
.cat-section { padding: 26px 0 4px; }
.cat-page { padding: 30px 0 10px; }

.section-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 16px;
}
.section-head h1, .section-head h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.18rem;
  font-weight: 700;
}
.section-head h1 { font-size: 1.5rem; }
.section-head i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--chip, var(--accent));
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--chip, var(--accent)) 15%, transparent);
}
.section-head .more {
  margin-left: auto;
  font-size: 13.5px;
  color: var(--muted);
  transition: color 0.15s;
}
.section-head .more:hover { color: var(--accent); }

.page-head { flex-wrap: wrap; }
.cat-desc { width: 100%; color: var(--muted); font-size: 14.5px; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  padding: 20px 22px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lift);
  border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
}

.card h3 {
  font-size: 16.5px;
  line-height: 1.55;
  font-weight: 650;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card h3 a:hover { color: var(--accent); }

.card .dek {
  font-size: 13.5px;
  color: var(--muted);
  line-height: 1.7;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card .meta { margin-top: auto; }

/* ---------- 文章页 ---------- */
.article { max-width: 720px; margin: 0 auto; padding: 38px 0 10px; }

.article-head {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 14px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 26px;
}

.article-head h1 {
  font-size: clamp(1.5rem, 4vw, 2.1rem);
  line-height: 1.42;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.article-head .lead {
  font-size: 16.5px;
  color: var(--muted);
  line-height: 1.8;
}

.article-body p {
  font-size: 17px;
  line-height: 1.92;
  margin-bottom: 1.25em;
  letter-spacing: 0.015em;
}

.article-body h2 {
  font-size: 1.25rem;
  margin: 1.6em 0 0.7em;
}

.tags { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 20px; }
.tag {
  padding: 3px 12px;
  border-radius: 999px;
  background: var(--surface2);
  border: 1px solid var(--border);
  font-size: 12.5px;
  color: var(--muted);
}

.source-box {
  background: var(--surface2);
  border-left: 3px solid var(--accent);
  border-radius: 10px;
  padding: 16px 20px;
  margin: 8px 0 26px;
  font-size: 14px;
  color: var(--muted);
  line-height: 1.8;
}
.source-box a {
  display: inline-block;
  margin-top: 6px;
  color: var(--accent);
  font-weight: 600;
}
.source-box a:hover { text-decoration: underline; }

.related { max-width: 1080px; margin: 0 auto; padding-bottom: 10px; }

/* ---------- 空状态 / 页脚 ---------- */
.empty { text-align: center; padding: 90px 0; }
.empty h1 { font-size: 1.6rem; margin-bottom: 10px; }
.empty p, .empty-note { color: var(--muted); }
.empty-note { padding: 30px 0 50px; }

.footer {
  margin-top: 48px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.footer-in {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 30px;
  padding: 36px 20px 26px;
}

.footer-brand p {
  margin-top: 12px;
  font-size: 13.5px;
  color: var(--muted);
  line-height: 1.8;
  max-width: 420px;
}

.footer-col h3 {
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: 12px;
}
.footer-col a {
  display: block;
  font-size: 14px;
  color: var(--muted);
  padding: 3px 0;
  transition: color 0.15s;
}
.footer-col a:hover { color: var(--accent); }

.footer-bottom {
  border-top: 1px solid var(--border);
  padding-top: 16px;
  padding-bottom: 22px;
  font-size: 12.5px;
  color: var(--muted);
}

/* ---------- 响应式 ---------- */
@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; padding-top: 22px; }
  .hero-main { padding: 24px 22px; }
  .today { display: none; }
  .footer-in { grid-template-columns: 1fr 1fr; }
  .footer-brand { grid-column: 1 / -1; }
}

@media (max-width: 560px) {
  .wrap { padding: 0 16px; }
  .topbar-in { gap: 12px; height: 54px; }
  .brand-name { display: none; }
  .grid { grid-template-columns: 1fr; }
  .article { padding-top: 26px; }
  .article-body p { font-size: 16.5px; }
}

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