/* ---------- Design tokens ---------- */
:root {
  --brand: #4f46e5;
  --brand-dark: #4338ca;
  --ink: #111827;
  --muted: #6b7280;
  --bg: #ffffff;
  --bg-alt: #f5f6fa;
  --border: #e5e7eb;
  --radius: 12px;
  --shadow: 0 4px 20px rgba(17, 24, 39, 0.08);
  --container: 1140px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.6;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }

.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 20px;
}

.section { padding: 56px 20px; }
.section-alt { background: var(--bg-alt); border-radius: var(--radius); }

.section-title {
  font-size: 1.6rem;
  margin: 0 0 24px;
  position: relative;
  padding-bottom: 10px;
}
.section-title::after {
  content: "";
  position: absolute;
  left: 0; bottom: 0;
  width: 54px; height: 4px;
  background: var(--brand);
  border-radius: 4px;
}

.badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--brand);
  background: rgba(79, 70, 229, 0.1);
  padding: 3px 10px;
  border-radius: 999px;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
}
.logo img { height: 36px; width: auto; }

.site-nav ul {
  display: flex;
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.site-nav a {
  display: block;
  padding: 8px 14px;
  border-radius: 8px;
  font-weight: 600;
  color: var(--muted);
  transition: color .15s, background .15s;
}
.site-nav a:hover { color: var(--ink); background: var(--bg-alt); }
.site-nav a.active { color: var(--brand); background: rgba(79, 70, 229, 0.1); }

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  width: 42px; height: 42px;
  padding: 10px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
}
.nav-toggle span {
  display: block;
  height: 2px;
  background: var(--ink);
  border-radius: 2px;
  transition: transform .25s, opacity .2s;
}
.nav-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------- Slider ---------- */
.slider {
  position: relative;
  max-width: var(--container);
  margin: 24px auto 0;
  padding: 0 20px;
}
.slides {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  aspect-ratio: 1200 / 450;
}
.slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity .6s ease;
}
.slide.active { opacity: 1; position: relative; }
.slide img { width: 100%; height: 100%; object-fit: cover; }

.slider-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px; height: 44px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.85);
  color: var(--ink);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: var(--shadow);
}
.slider-btn.prev { left: 34px; }
.slider-btn.next { right: 34px; }

.slider-dots {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 14px;
}
.slider-dots button {
  width: 10px; height: 10px;
  border: none;
  border-radius: 50%;
  background: var(--border);
  cursor: pointer;
  padding: 0;
}
.slider-dots button.active { background: var(--brand); }

/* ---------- Recent: card grid ---------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}
.card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform .2s, box-shadow .2s;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.card-img { aspect-ratio: 3 / 2; overflow: hidden; }
.card-img img { width: 100%; height: 100%; object-fit: cover; }
.card-body { padding: 16px 18px 20px; }
.card-title { font-size: 1.1rem; margin: 10px 0 6px; }
.card-date { color: var(--muted); font-size: 0.85rem; margin: 0; }

/* ---------- Most viewed: numbered list ---------- */
.popular-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 14px;
}
.popular-item {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
}
.rank {
  flex: none;
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--brand);
  width: 34px;
  text-align: center;
}
.popular-thumb {
  flex: none;
  width: 84px;
  aspect-ratio: 1 / 1;
  border-radius: 10px;
  overflow: hidden;
}
.popular-thumb img { width: 100%; height: 100%; object-fit: cover; }
.popular-title { font-size: 1.02rem; margin: 0 0 4px; }
.popular-meta { color: var(--muted); font-size: 0.85rem; margin: 0; }

/* ---------- Blog list page ---------- */
.page-title { font-size: 2.2rem; margin: 0 0 6px; }
.page-subtitle { color: var(--muted); margin: 0 0 32px; font-size: 1.05rem; }

.blog-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}
.blog-row {
  display: flex;
  gap: 18px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  transition: transform .2s, box-shadow .2s;
}
.blog-row:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.blog-row-text { flex: 1; min-width: 0; }
.blog-row-title { font-size: 1.15rem; margin: 10px 0 6px; }
.blog-row-date { color: var(--muted); font-size: 0.82rem; margin: 0 0 8px; }
.blog-row-desc {
  color: var(--muted);
  font-size: 0.92rem;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.blog-row-img {
  flex: none;
  width: 130px;
  aspect-ratio: 3 / 4;
  border-radius: 10px;
  overflow: hidden;
}
.blog-row-img img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- Blog details ---------- */
.post { padding-top: 48px; padding-bottom: 24px; max-width: 820px; }
.post-header { margin-bottom: 20px; }
.post-title { font-size: 2.3rem; line-height: 1.2; margin: 12px 0 14px; }
.post-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 0.92rem;
  margin: 0;
}
.post-hero {
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  border-radius: var(--radius);
  margin-bottom: 28px;
}
.post-body { font-size: 1.06rem; }
.post-body h2 { margin-top: 32px; font-size: 1.5rem; }
.post-body ul { padding-left: 22px; }

.related {
  max-width: var(--container);
  padding-top: 20px;
  padding-bottom: 60px;
}
.related-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
}
.related-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform .2s, box-shadow .2s;
}
.related-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.related-card img { aspect-ratio: 3 / 2; object-fit: cover; width: 100%; }
.related-card h3 { font-size: 1rem; margin: 0; padding: 14px 16px 18px; }

/* ---------- Contact ---------- */
.contact-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 32px;
}
.contact-form { display: grid; gap: 16px; }
.contact-form label {
  display: grid;
  gap: 6px;
  font-weight: 600;
  font-size: 0.9rem;
}
.contact-form input,
.contact-form textarea {
  font: inherit;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  font-weight: 400;
}
.contact-form input:focus,
.contact-form textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}
.btn {
  justify-self: start;
  border: none;
  background: var(--brand);
  color: #fff;
  font-weight: 700;
  padding: 12px 26px;
  border-radius: 10px;
  cursor: pointer;
  transition: background .15s;
}
.btn:hover { background: var(--brand-dark); }
.contact-info {
  background: var(--bg-alt);
  border-radius: var(--radius);
  padding: 24px;
}
.contact-info h3 { margin-top: 0; }
.contact-info p { color: var(--muted); }

/* ---------- Footer ---------- */
.site-footer {
  margin-top: 40px;
  border-top: 1px solid var(--border);
  background: var(--bg-alt);
  padding: 28px 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.92rem;
}
.site-footer p { margin: 0; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .card-grid { grid-template-columns: repeat(2, 1fr); }
  .related-grid { grid-template-columns: repeat(3, 1fr); }
  .contact-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .nav-toggle { display: flex; }
  .site-nav {
    position: absolute;
    top: 68px;
    left: 0;
    right: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    max-height: 0;
    overflow: hidden;
    transition: max-height .25s ease;
  }
  .site-nav.open { max-height: 320px; }
  .site-nav ul { flex-direction: column; padding: 10px 20px 18px; gap: 4px; }
  .site-nav a { padding: 12px 14px; }

  .blog-list { grid-template-columns: 1fr; }
  .related-grid { grid-template-columns: 1fr; }
  .slider-btn.prev { left: 26px; }
  .slider-btn.next { right: 26px; }
  .post-title { font-size: 1.8rem; }
  .section { padding: 40px 20px; }
}

@media (max-width: 520px) {
  .card-grid { grid-template-columns: 1fr; }
  .popular-item { gap: 12px; padding: 10px 12px; }
  .popular-thumb { width: 64px; }
  .rank { width: 24px; font-size: 1.2rem; }
  .blog-row { flex-direction: column-reverse; }
  .blog-row-img { width: 100%; aspect-ratio: 16 / 9; }
  .slider-btn { width: 38px; height: 38px; }
  .page-title { font-size: 1.7rem; }
}
