/* TrendPosts — clean, fast, mobile-first blog theme */
:root {
  --bg: #ffffff;
  --ink: #1a1a2e;
  --muted: #6b7280;
  --line: #eef0f4;
  --brand: #6c5ce7;
  --brand-dark: #5649c9;
  --card: #fafbfc;
}
html[data-theme="dark"] {
  --bg: #12121c;
  --ink: #eceaf6;
  --muted: #a2a0b5;
  --line: #262638;
  --card: #1a1a28;
}
html[data-theme="dark"] body { background: var(--bg); color: var(--ink); }
html[data-theme="dark"] .site-header { background: #171724; }
html[data-theme="dark"] .card, html[data-theme="dark"] .featured, html[data-theme="dark"] .toc,
html[data-theme="dark"] .author-box, html[data-theme="dark"] .trending { background: var(--card); }
html[data-theme="dark"] .hero { background: linear-gradient(180deg,#1d1a33 0%,#12121c 100%); }
html[data-theme="dark"] .search-box input { background: #1a1a28; color: var(--ink); }
#progressBar { position: fixed; top: 0; left: 0; height: 3px; width: 0; background: var(--brand); z-index: 50; }
.menu-btn { display: none; background: none; border: 0; font-size: 1.5rem; cursor: pointer; color: var(--ink); padding: 8px 10px; }
.theme-btn { background: none; border: 1px solid var(--line); border-radius: 999px; cursor: pointer; font-size: 0.95rem; margin-left: 16px; padding: 5px 10px; }
#topBtn { display: none; position: fixed; right: 18px; bottom: 18px; width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--brand); color: #fff; font-size: 1.2rem; cursor: pointer; box-shadow: 0 6px 18px rgba(0,0,0,.25); z-index: 40; }
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.65;
}
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 20px; }

/* header */
.site-header {
  border-bottom: 1px solid var(--line);
  background: linear-gradient(90deg,#ffffff,#f4f2ff);
  position: sticky; top: 0; z-index: 10;
  box-shadow: 0 2px 12px rgba(108,92,231,.08);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 62px; }
.brand { font-size: 1.6rem; font-weight: 800; color: var(--ink); text-decoration: none; letter-spacing: -0.5px; }
.brand .dot { color: var(--brand); }
.nav a { color: var(--muted); text-decoration: none; margin-left: 22px; font-size: 0.95rem; font-weight: 500; }
.nav a:hover { color: var(--brand); }

/* hero */
.hero { text-align: center; padding: 56px 10px 30px; background: linear-gradient(180deg,#f4f2ff 0%,#ffffff 100%); border-radius: 0 0 24px 24px; }
.hero h1 { font-size: 2.5rem; line-height: 1.25; margin: 0 0 10px; letter-spacing: -0.5px; }
.hero h1 em { color: var(--brand); font-style: normal; }
.hero p { color: var(--muted); font-size: 1.08rem; margin: 0; }
.search-box { display: flex; gap: 8px; max-width: 560px; margin: 22px auto 10px; }
.search-box input { flex: 1; padding: 13px 16px; border: 2px solid var(--line); border-radius: 999px; font-size: 1rem; font-family: inherit; outline: none; }
.search-box input:focus { border-color: var(--brand); }
.search-box button { background: var(--brand); color: #fff; border: 0; border-radius: 999px; padding: 12px 26px; font-weight: 700; cursor: pointer; }
.search-box button:hover { background: var(--brand-dark); }
.search-box.big { max-width: 700px; margin: 6px 0 14px; }
.hero-trending { font-size: 0.9rem !important; }
.hero-trending a { color: var(--brand); text-decoration: none; font-weight: 600; }
.sort-bar { margin: 10px 0 18px; display: flex; gap: 14px; align-items: center; }
.sort-bar select { padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; font-family: inherit; font-size: 0.95rem; }
.card-new { position: absolute; right: 14px; top: 12px; background: #ff4757; color: #fff; font-size: 0.72rem; font-weight: 800; padding: 4px 10px; border-radius: 999px; letter-spacing: .5px; }

/* category chips */
.cats { text-align: center; margin-bottom: 30px; }
.chip {
  display: inline-block; border: 1px solid var(--line); border-radius: 999px;
  padding: 6px 16px; margin: 4px; font-size: 0.88rem; color: var(--ink);
  text-decoration: none; background: var(--card);
}
.chip:hover { border-color: var(--brand); color: var(--brand); }

/* article grid */
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; padding-bottom: 40px; }
@media (max-width: 900px) { .grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) {
  .grid { grid-template-columns: 1fr; }
  .hero h1 { font-size: 1.7rem; }
  .hero { padding: 36px 6px 22px; }
  .menu-btn { display: block; }
  .header-inner { flex-wrap: wrap; height: auto; padding-top: 10px; padding-bottom: 10px; }
  .nav { display: none; width: 100%; padding: 8px 0 4px; }
  .nav.open { display: block; }
  .nav a { display: block; margin: 0; padding: 10px 4px; border-top: 1px solid var(--line); font-size: 1rem; }
  .theme-btn { margin: 8px 0 4px; }
  .brand { font-size: 1.35rem; }
  .search-box { flex-direction: column; }
  .search-box button { padding: 13px; }
  .featured-body h2 { font-size: 1.3rem; }
  .featured-banner { height: 130px; }
  .post-title { font-size: 1.55rem; }
  .post-banner { height: 120px; }
  .post-content { font-size: 1rem; }
  .author-box { flex-direction: column; }
  .card-banner { height: 100px; }
  .wrap { padding: 0 14px; }
}
@media (max-width: 380px) { .hero h1 { font-size: 1.45rem; } .trending li { font-size: 0.92rem; } }
.card {
  border: 1px solid var(--line); border-radius: 14px; overflow: hidden;
  background: #fff; transition: transform .15s ease, box-shadow .15s ease;
}
.card:hover { transform: translateY(-3px); box-shadow: 0 10px 28px rgba(0,0,0,.08); }
.card-link { text-decoration: none; color: inherit; display: block; }
.card-banner { height: 120px; position: relative; }
.card-cat {
  position: absolute; left: 14px; bottom: 12px;
  background: rgba(255,255,255,.92); font-size: 0.75rem; font-weight: 700;
  padding: 4px 12px; border-radius: 999px; text-transform: uppercase; letter-spacing: .4px;
}
.card-body { padding: 18px; }
.card-body h2 { font-size: 1.08rem; margin: 0 0 8px; line-height: 1.4; }
.card-desc { color: var(--muted); font-size: 0.92rem; margin: 0 0 10px; }
.meta { color: var(--muted); font-size: 0.82rem; margin: 0; }

/* article page */
.post { max-width: 760px; margin: 34px auto 0; }
.post-cat { font-weight: 700; text-transform: uppercase; font-size: 0.82rem; letter-spacing: .6px; margin: 0 0 6px; }
.post-title { font-size: 2rem; line-height: 1.3; margin: 0 0 10px; letter-spacing: -0.4px; }
.post-banner { height: 180px; border-radius: 14px; margin: 22px 0 6px; }
.post-content { font-size: 1.06rem; }
.post-content h2 { font-size: 1.45rem; margin: 34px 0 12px; letter-spacing: -0.3px; }
.post-content h3 { font-size: 1.2rem; margin: 26px 0 10px; }
.post-content img { max-width: 100%; border-radius: 10px; }
.post-content blockquote {
  border-left: 4px solid var(--brand); margin: 20px 0; padding: 6px 18px;
  color: var(--muted); font-style: italic; background: var(--card); border-radius: 0 10px 10px 0;
}
.post-content pre { background: #1a1a2e; color: #e8e8f0; padding: 16px; border-radius: 10px; overflow-x: auto; }
.post-content code { background: #f1f2f6; padding: 2px 6px; border-radius: 5px; font-size: 0.92em; }
.post-content pre code { background: none; padding: 0; }
.post-content a { color: var(--brand); }
.tags { margin-top: 26px; }
.tag { display: inline-block; background: var(--card); border: 1px solid var(--line);
  border-radius: 999px; padding: 4px 14px; font-size: 0.82rem; margin: 0 6px 6px 0; color: var(--muted); }

/* generic pages */
.page-title { font-size: 1.9rem; margin: 34px 0 18px; letter-spacing: -0.4px; }

/* contact form */
.contact-form { max-width: 560px; margin: 10px 0 40px; }
.contact-form label { display: block; font-weight: 600; margin: 14px 0 6px; }
.contact-form input, .contact-form textarea {
  width: 100%; padding: 12px; border: 1px solid var(--line); border-radius: 10px; font-size: 1rem; font-family: inherit;
}
.contact-form button {
  margin-top: 16px; background: var(--brand); color: #fff; border: 0; border-radius: 10px;
  padding: 12px 30px; font-size: 1rem; font-weight: 700; cursor: pointer;
}
.contact-form button:hover { background: var(--brand-dark); }

/* featured + trending + newsletter */
.featured { border: 1px solid var(--line); border-radius: 16px; overflow: hidden; margin: 6px 0 26px; background: #fff; }
.featured-link { text-decoration: none; color: inherit; display: block; }
.featured-banner { height: 190px; position: relative; }
.featured-body { padding: 22px; }
.featured-body h2 { font-size: 1.7rem; margin: 0 0 8px; line-height: 1.3; letter-spacing: -0.4px; }
.featured-body p { color: var(--muted); margin: 0 0 8px; }
.section-title { font-size: 1.5rem; margin: 10px 0 16px; letter-spacing: -0.3px; }
.trending { border: 1px solid var(--line); border-radius: 16px; padding: 18px 22px; margin-bottom: 26px; background: var(--card); }
.trending h3 { margin: 0 0 10px; font-size: 1.15rem; }
.trending ol { list-style: none; margin: 0; padding: 0; }
.trending li { display: flex; gap: 12px; align-items: baseline; padding: 7px 0; border-bottom: 1px dashed var(--line); }
.trending li:last-child { border-bottom: 0; }
.trend-num { font-weight: 800; color: var(--brand); font-size: 1.15rem; min-width: 22px; }
.trending a { color: var(--ink); text-decoration: none; font-weight: 600; }
.trending a:hover { color: var(--brand); }
.newsletter { text-align: center; background: linear-gradient(135deg,var(--brand),#0984e3); color: #fff; border-radius: 16px; padding: 30px 20px; margin: 6px 0 40px; }
.newsletter h3 { margin: 0 0 6px; font-size: 1.35rem; }
.newsletter p { margin: 0 0 16px; opacity: .92; }
.btn.light { background: #fff; color: var(--brand-dark); }

/* article extras */
.crumbs { max-width: 760px; margin: 22px auto 0; font-size: 0.85rem; color: var(--muted); }
.crumbs a { color: var(--brand); text-decoration: none; }
.crumbs span { color: var(--muted); }
.toc { border: 1px solid var(--line); background: var(--card); border-radius: 12px; padding: 14px 20px; margin: 18px 0; }
.toc h4 { margin: 0 0 8px; font-size: 1rem; }
.toc ul { margin: 0; padding-left: 18px; }
.toc a { color: var(--ink); text-decoration: none; }
.toc a:hover { color: var(--brand); }
.share { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 26px 0 6px; }
.share span { font-weight: 700; }
.share a { border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px; text-decoration: none; color: var(--ink); font-size: 0.88rem; background: var(--card); }
.share a:hover { border-color: var(--brand); color: var(--brand); }
.author-box { display: flex; gap: 16px; border: 1px solid var(--line); background: var(--card); border-radius: 14px; padding: 18px; margin: 20px 0; }
.author-avatar { width: 52px; height: 52px; min-width: 52px; border-radius: 50%; background: var(--brand); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 800; }
.author-box p { margin: 4px 0 0; color: var(--muted); font-size: 0.94rem; }
.prevnext { max-width: 760px; margin: 10px auto 0; display: flex; flex-direction: column; gap: 8px; }
.prevnext .pn { color: var(--brand); text-decoration: none; font-weight: 600; font-size: 0.95rem; }

/* misc */
.center { text-align: center; }
.btn {
  display: inline-block; background: var(--brand); color: #fff; text-decoration: none;
  padding: 12px 30px; border-radius: 10px; font-weight: 700;
}
.btn:hover { background: var(--brand-dark); }

/* footer */
.site-footer { border-top: 1px solid var(--line); margin-top: 30px; background: var(--card); }
.footer-inner { padding: 30px 20px; text-align: center; }
.footer-inner p { margin: 6px 0; }
.tiny { font-size: 0.85rem; color: var(--muted); }
.tiny a { color: var(--muted); text-decoration: none; }
.tiny a:hover { color: var(--brand); }
