:root {
  --bg: #f6f5f1;
  --surface: #ffffff;
  --ink: #16161a;
  --muted: #6b6b73;
  --line: #e7e4dc;
  --accent: #b23a3a;
  --accent-soft: rgba(178, 58, 58, 0.10);
  --shadow: 0 1px 2px rgba(20, 20, 26, 0.04), 0 8px 24px rgba(20, 20, 26, 0.05);
  --radius: 14px;
  --serif: "Noto Serif SC", Georgia, "Times New Roman", serif;
  --sans: "Noto Sans SC", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

[data-theme="dark"] {
  --bg: #131319;
  --surface: #1c1c23;
  --ink: #f2f1ec;
  --muted: #9a9aa3;
  --line: #2c2c34;
  --accent: #e07979;
  --accent-soft: rgba(224, 121, 121, 0.14);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 30px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background 0.3s ease, color 0.3s ease;
}

.wrap {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 18px;
  padding-bottom: 18px;
}

.brand-name {
  font-family: var(--serif);
  font-weight: 900;
  font-size: 26px;
  letter-spacing: 0.04em;
  margin: 0;
  line-height: 1.1;
}

.brand-sub {
  display: block;
  font-size: 10.5px;
  letter-spacing: 0.32em;
  color: var(--muted);
  margin-top: 4px;
  font-weight: 500;
}

.header-meta {
  display: flex;
  align-items: center;
  gap: 12px;
}

.updated {
  font-size: 13px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.pill {
  font-size: 12px;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
  padding: 5px 12px;
  border-radius: 999px;
  white-space: nowrap;
  font-weight: 500;
}

.theme-toggle {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  font-size: 17px;
  display: grid;
  place-items: center;
  transition: transform 0.2s ease, border-color 0.2s ease;
}
.theme-toggle:hover { transform: rotate(-12deg); border-color: var(--accent); }

.lang-toggle {
  min-width: 38px;
  height: 38px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  font-family: var(--sans);
  display: grid;
  place-items: center;
  transition: transform 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.lang-toggle:hover { border-color: var(--accent); color: var(--accent); }

@media (max-width: 640px) {
  .brand-sub { display: none; }
  .pill { display: none; }
  .brand-name { font-size: 21px; }
}

/* ---------- Sample banner ---------- */
.sample-banner {
  background: var(--accent-soft);
  color: var(--accent);
  text-align: center;
  font-size: 13px;
  padding: 9px 16px;
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 20%, transparent);
}

/* ---------- Featured ---------- */
.featured {
  margin: 40px 0 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 38px 40px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.featured::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  background: var(--accent);
}

.featured .tag { font-size: 12px; }
.featured h2 {
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(26px, 4vw, 40px);
  line-height: 1.25;
  margin: 14px 0 16px;
  letter-spacing: 0.01em;
}
.featured p {
  font-size: 16px;
  color: var(--muted);
  margin: 0 0 20px;
  max-width: 80ch;
}
.featured .meta { font-size: 13.5px; }

@media (max-width: 640px) {
  .featured { padding: 26px 22px; }
}

/* ---------- Tags ---------- */
.tag {
  display: inline-block;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--accent);
  text-transform: none;
}

/* ---------- Controls ---------- */
.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 34px 0 22px;
}

.controls-label {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.06em;
  color: var(--ink);
  margin-right: 2px;
  align-self: center;
}
@media (max-width: 720px) {
  .controls-label { display: none; }
}

.search-box {
  position: relative;
  flex: 1 1 280px;
  max-width: 420px;
}
.search-icon {
  position: absolute;
  left: 14px; top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 17px;
}
#search {
  width: 100%;
  padding: 11px 14px 11px 40px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
#search:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.chips {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}
.chips::-webkit-scrollbar { height: 6px; }
.chips::-webkit-scrollbar-thumb { background: var(--line); border-radius: 999px; }
.chip { flex: 0 0 auto; }
.chip {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  padding: 7px 15px;
  border-radius: 999px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.18s ease;
  font-family: var(--sans);
}
.chip:hover { color: var(--ink); border-color: var(--accent); }
.chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 500;
}

/* ---------- Grid ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 18px;
  padding-bottom: 40px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 22px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
  border-color: color-mix(in srgb, var(--accent) 35%, var(--line));
}
.card h3 {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 19px;
  line-height: 1.4;
  margin: 2px 0 0;
}
.card h3 a { color: inherit; text-decoration: none; }
.card h3 a:hover { color: var(--accent); }
.card .summary {
  font-size: 14px;
  color: var(--muted);
  margin: 0;
  flex: 1;
}
.card .meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 12.5px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  padding-top: 12px;
  margin-top: 4px;
}
.card .meta .src { font-weight: 500; color: var(--ink); }
.card .meta .ext { color: var(--accent); text-decoration: none; font-weight: 500; }
.card .meta .ext:hover { text-decoration: underline; }

/* ---------- Empty / states ---------- */
.empty {
  text-align: center;
  color: var(--muted);
  padding: 60px 0;
  font-size: 15px;
}

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 30px 0 48px;
  margin-top: 20px;
}
.footer-line {
  font-family: var(--serif);
  font-weight: 500;
  margin: 0 0 6px;
  font-size: 15px;
}
.footer-sub {
  margin: 0;
  font-size: 12.5px;
  color: var(--muted);
}
