:root {
  --font-ui: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-serif: "Lora", Georgia, "Times New Roman", serif;

  --color-bg: #f7f6f3;
  --color-surface: #ffffff;
  --color-text: #1f2933;
  --color-muted: #6b7280;
  --color-border: #e5e4e0;
  --color-primary: #613ea3;
  --color-primary-dark: #462a72;
  --color-accent: #b45309;
  --color-danger: #b91c1c;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 8px 24px rgba(16, 24, 40, 0.06);
  --container: 1160px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-ui);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--color-primary); text-decoration: none; }
a:hover { color: var(--color-primary-dark); }

img { max-width: 100%; display: block; }

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

.muted { color: var(--color-muted); }
.small { font-size: 0.82rem; }

/* ------------------------------------------------------------- header */
.site-header {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 50;
}

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

.brand { display: flex; align-items: center; gap: 12px; color: var(--color-text); }
.brand:hover { color: var(--color-text); }

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--color-primary);
  color: #fff;
  font-weight: 800;
  letter-spacing: 0.5px;
}

.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong { font-size: 1.15rem; font-weight: 800; }
.brand-text small { color: var(--color-muted); font-size: 0.78rem; }

.search { display: flex; gap: 0; max-width: 360px; width: 100%; }
.search input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--color-border);
  border-right: none;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  font-family: inherit;
  font-size: 0.92rem;
  background: #fbfbfa;
}
.search input:focus { outline: 2px solid var(--color-primary); outline-offset: -1px; }
.search button {
  padding: 0 18px;
  border: 1px solid var(--color-primary);
  background: var(--color-primary);
  color: #fff;
  font-family: inherit;
  font-weight: 600;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  cursor: pointer;
}
.search button:hover { background: var(--color-primary-dark); }

.main-nav { border-top: 1px solid var(--color-border); background: var(--color-surface); }
.nav-inner { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.nav-inner a {
  padding: 12px 14px;
  color: var(--color-text);
  font-weight: 500;
  font-size: 0.94rem;
  border-bottom: 3px solid transparent;
}
.nav-inner a:hover { color: var(--color-primary); }
.nav-inner a.is-active { color: var(--color-primary); border-bottom-color: var(--color-primary); }
.nav-inner .nav-admin { margin-left: auto; color: var(--color-muted); font-weight: 600; }

/* --------------------------------------------------------------- main */
.site-main { padding: 32px 20px 56px; }

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 40px;
  align-items: start;
}

.section-head,
.page-head { margin-bottom: 24px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; }
.section-head h1,
.page-head h1 { font-size: 1.75rem; margin: 0; font-weight: 800; letter-spacing: -0.02em; }
.lead { color: var(--color-muted); font-size: 1.02rem; margin: 8px 0 0; }
.empty { color: var(--color-muted); padding: 32px; background: var(--color-surface); border-radius: var(--radius); }

/* -------------------------------------------------------------- cards */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 24px;
}

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  display: flex;
  flex-direction: column;
}
.card:hover { transform: translateY(-3px); box-shadow: 0 12px 28px rgba(16, 24, 40, 0.12); }

.card-thumb {
  aspect-ratio: 16 / 9;
  background: linear-gradient(135deg, #613ea3, #744bc4);
  display: block;
  overflow: hidden;
}
.card-thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb-placeholder {
  display: grid;
  place-items: center;
  height: 100%;
  color: rgba(255, 255, 255, 0.9);
  font-size: 2.4rem;
  font-weight: 800;
  font-family: var(--font-serif);
}

.card-body { padding: 18px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.badge {
  display: inline-block;
  align-self: flex-start;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-primary);
  background: rgba(97, 62, 163, 0.1);
  padding: 3px 10px;
  border-radius: 999px;
}
.card-title { margin: 0; font-size: 1.1rem; line-height: 1.35; font-weight: 700; }
.card-title a { color: var(--color-text); }
.card-title a:hover { color: var(--color-primary); }
.card-summary { margin: 0; color: var(--color-muted); font-size: 0.92rem; flex: 1; }
.card-meta { display: flex; gap: 8px; color: var(--color-muted); font-size: 0.8rem; }

/* ------------------------------------------------------------ sidebar */
.sidebar { display: flex; flex-direction: column; gap: 24px; position: sticky; top: 150px; }
.widget {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.widget h2 {
  margin: 0 0 14px;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--color-primary);
  display: inline-block;
}
.cat-list { list-style: none; margin: 0; padding: 0; }
.cat-list li { border-bottom: 1px dashed var(--color-border); }
.cat-list li:last-child { border-bottom: none; }
.cat-list a { display: block; padding: 9px 0; color: var(--color-text); font-weight: 500; }
.cat-list a:hover, .cat-list a.is-active { color: var(--color-primary); }

.latest-list { list-style: none; margin: 0; padding: 0; counter-reset: item; }
.latest-list li { padding: 10px 0; border-bottom: 1px dashed var(--color-border); display: flex; flex-direction: column; gap: 3px; }
.latest-list li:last-child { border-bottom: none; }
.latest-list a { color: var(--color-text); font-weight: 500; font-size: 0.94rem; }
.latest-list a:hover { color: var(--color-primary); }
.latest-list small { color: var(--color-muted); font-size: 0.78rem; }

/* ------------------------------------------------------------- article */
.article-detail { max-width: 760px; }
.breadcrumb { font-size: 0.85rem; color: var(--color-muted); margin-bottom: 16px; }
.breadcrumb a { color: var(--color-muted); }
.breadcrumb a:hover { color: var(--color-primary); }

.article-header { margin-bottom: 24px; }
.article-header h1 { font-size: 2.1rem; line-height: 1.25; margin: 12px 0; font-weight: 800; letter-spacing: -0.02em; }
.article-meta { display: flex; flex-wrap: wrap; gap: 8px; color: var(--color-muted); font-size: 0.86rem; margin-top: 12px; }

.article-cover { margin: 0 0 28px; border-radius: var(--radius); overflow: hidden; }

.article-content {
  font-family: var(--font-serif);
  font-size: 1.08rem;
  line-height: 1.8;
  color: #2b3440;
}
.article-content h2 { font-family: var(--font-ui); font-size: 1.4rem; margin: 32px 0 12px; font-weight: 700; }
.article-content h3 { font-family: var(--font-ui); font-size: 1.18rem; margin: 24px 0 10px; font-weight: 700; }
.article-content p { margin: 0 0 18px; }
.article-content img { border-radius: var(--radius-sm); margin: 20px 0; }
.article-content blockquote {
  margin: 24px 0;
  padding: 12px 20px;
  border-left: 4px solid var(--color-primary);
  background: rgba(97, 62, 163, 0.06);
  font-style: italic;
}
.article-content ul, .article-content ol { margin: 0 0 18px; padding-left: 24px; }
.article-content li { margin-bottom: 8px; }
.article-actions { margin-top: 36px; padding-top: 20px; border-top: 1px solid var(--color-border); }

/* ---------------------------------------------------------- pagination */
.pagination { display: flex; gap: 6px; margin-top: 32px; flex-wrap: wrap; }
.page-link {
  min-width: 40px;
  text-align: center;
  padding: 8px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text);
  font-weight: 500;
}
.page-link:hover { border-color: var(--color-primary); color: var(--color-primary); }
.page-link.is-active { background: var(--color-primary); border-color: var(--color-primary); color: #fff; }

/* -------------------------------------------------------------- button */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-family: inherit;
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.btn-primary { background: var(--color-primary); color: #fff; }
.btn-primary:hover { background: var(--color-primary-dark); color: #fff; }
.btn-ghost { background: transparent; border-color: var(--color-border); color: var(--color-text); }
.btn-ghost:hover { border-color: var(--color-primary); color: var(--color-primary); }
.btn-sm { padding: 6px 12px; font-size: 0.82rem; }
.btn-block { width: 100%; }

/* -------------------------------------------------------------- footer */
.site-footer { background: #2b1b45; color: #d9d2ea; margin-top: 40px; }
.footer-inner { display: grid; grid-template-columns: 1fr auto; gap: 20px; padding: 40px 20px; }
.footer-inner strong { color: #fff; font-size: 1.1rem; }
.footer-inner p { margin: 6px 0 0; font-size: 0.9rem; }
.footer-links { display: flex; gap: 20px; align-items: start; }
.footer-links a { color: #cfd8d6; font-size: 0.9rem; }
.footer-links a:hover { color: #fff; }
.copyright { grid-column: 1 / -1; border-top: 1px solid rgba(255, 255, 255, 0.12); padding-top: 16px; color: #8ba39e; font-size: 0.82rem; }

/* ----------------------------------------------------------- responsive */
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; gap: 32px; }
  .sidebar { position: static; }
  .article-header h1 { font-size: 1.7rem; }
}

@media (max-width: 620px) {
  .header-inner { flex-direction: column; align-items: stretch; }
  .search { max-width: none; }
  .footer-inner { grid-template-columns: 1fr; }
}

/* ==================================================== homepage blocks */
.home-block { margin-bottom: 44px; }
.home-block .section-head h2 { font-size: 1.5rem; margin: 0; font-weight: 800; }

/* ------------------------------------------------------ hero carousel */
.hero-carousel {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 44px;
  background: linear-gradient(135deg, #462a72, #613ea3);
  box-shadow: var(--shadow);
}
.hero-track { position: relative; }
.hero-slide { display: none; grid-template-columns: 1.05fr 1fr; min-height: 380px; }
.hero-slide.is-active { display: grid; }
.hero-caption {
  padding: 44px;
  color: #fff;
  display: flex; flex-direction: column; justify-content: center; gap: 14px;
}
.hero-caption h2 { font-size: 2rem; line-height: 1.25; margin: 0; font-weight: 800; }
.hero-caption h2 a { color: #fff; }
.hero-caption h2 a:hover { color: #e9e2fb; }
.hero-caption p { margin: 0; color: rgba(255, 255, 255, 0.85); }
.hero-caption .badge { background: rgba(255, 255, 255, 0.18); color: #fff; }
.hero-cta { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.hero-cta .btn-primary { background: #fff; color: #462a72; }
.hero-cta .btn-primary:hover { background: #efe9fb; color: #462a72; }
.hero-cta .btn-ghost { color: #fff; border-color: rgba(255, 255, 255, 0.5); }
.hero-cta .btn-ghost:hover { color: #fff; border-color: #fff; }
.hero-media { overflow: hidden; }
.hero-media img { width: 100%; height: 100%; min-height: 380px; object-fit: cover; }

.carousel-arrow {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 42px; height: 42px; border-radius: 50%;
  border: none; background: rgba(255, 255, 255, 0.85); color: #462a72;
  font-size: 1.5rem; line-height: 1; cursor: pointer; z-index: 3;
  display: grid; place-items: center;
}
.carousel-arrow:hover { background: #fff; }
.carousel-arrow.prev { left: 14px; }
.carousel-arrow.next { right: 14px; }
.carousel-dots { position: absolute; bottom: 16px; left: 44px; display: flex; gap: 8px; z-index: 3; }
.carousel-dot {
  width: 9px; height: 9px; border-radius: 50%; padding: 0; border: none;
  background: rgba(255, 255, 255, 0.45); cursor: pointer; transition: all 0.2s ease;
}
.carousel-dot.is-active { background: #fff; width: 26px; border-radius: 999px; }

/* --------------------------------------------------------- feature grid */
.feature-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.feature-card {
  background: #fff; border: 1px solid var(--color-border); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column;
}
.feature-card .feature-media { display: block; aspect-ratio: 16 / 10; overflow: hidden; background: #efe9fb; }
.feature-card .feature-media img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.3s ease; }
.feature-card:hover .feature-media img { transform: scale(1.04); }
.feature-body { padding: 18px; display: flex; flex-direction: column; gap: 8px; }
.feature-body h3 { margin: 0; font-size: 1.15rem; line-height: 1.35; }
.feature-body h3 a { color: var(--color-text); }
.feature-body h3 a:hover { color: var(--color-primary); }
.feature-body p { margin: 0; color: var(--color-muted); font-size: 0.92rem; }
.feature-card-lg { grid-column: 1 / -1; flex-direction: row; }
.feature-card-lg .feature-media { flex: 1.15; aspect-ratio: auto; min-height: 300px; }
.feature-card-lg .feature-body { flex: 1; justify-content: center; padding: 30px; }
.feature-card-lg .feature-body h3 { font-size: 1.5rem; }

/* ---------------------------------------------------------- promo grid */
.promo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.promo-card {
  background: #fff; border: 1px solid var(--color-border); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column;
}
.promo-media { position: relative; aspect-ratio: 16 / 9; overflow: hidden; background: #efe9fb; }
.promo-media img { width: 100%; height: 100%; object-fit: cover; }
.promo-tag {
  position: absolute; top: 12px; left: 12px;
  background: rgba(17, 17, 17, 0.78); color: #fff;
  font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
  padding: 4px 10px; border-radius: 999px;
}
.promo-body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.promo-body h3 { margin: 0; font-size: 1.05rem; line-height: 1.35; }
.promo-body p { margin: 0; color: var(--color-muted); font-size: 0.9rem; flex: 1; }
.promo-cta { font-weight: 700; font-size: 0.9rem; color: var(--color-primary); }
.promo-cta:hover { color: var(--color-primary-dark); }

/* ----------------------------------------------------------- widgets */
.widget-newsletter p { color: var(--color-muted); font-size: 0.9rem; margin: 0 0 14px; }
.newsletter-form { display: flex; flex-direction: column; gap: 10px; }
.newsletter-form input {
  padding: 10px 13px; border: 1px solid var(--color-border);
  border-radius: var(--radius-sm); font: inherit; width: 100%;
}
.newsletter-form input:focus { outline: 2px solid var(--color-primary); outline-offset: -1px; }

.widget-ad .ad-banner { display: block; border-radius: 10px; overflow: hidden; }
.widget-ad .ad-banner img { width: 100%; }
.widget-ad .ad-banner span { display: block; padding: 10px 0 0; font-weight: 600; color: var(--color-primary); }

@media (max-width: 900px) {
  .hero-slide { grid-template-columns: 1fr; }
  .hero-media { order: -1; }
  .hero-media img { min-height: 220px; max-height: 240px; }
  .hero-caption { padding: 26px; }
  .hero-caption h2 { font-size: 1.5rem; }
  .carousel-dots { left: 26px; }
  .feature-grid { grid-template-columns: 1fr; }
  .feature-card-lg { flex-direction: column; }
  .feature-card-lg .feature-body { padding: 18px; }
  .promo-grid { grid-template-columns: 1fr; }
}

/* ==================================================== nav (compact) */
.nav-inner { position: relative; }
.nav-dropdown { position: relative; }
.nav-dropdown > summary {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 12px 14px;
  color: var(--color-text);
  font-weight: 500;
  font-size: 0.94rem;
  border-bottom: 3px solid transparent;
  user-select: none;
}
.nav-dropdown > summary::-webkit-details-marker { display: none; }
.nav-dropdown > summary:hover { color: var(--color-primary); }
.nav-dropdown[open] > summary { color: var(--color-primary); border-bottom-color: var(--color-primary); }
.nav-dropdown .chev { font-size: 0.7rem; transition: transform 0.15s ease; }
.nav-dropdown[open] .chev { transform: rotate(180deg); }

.dropdown-panel {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 80;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: 0 12px 30px rgba(16, 24, 40, 0.14);
  padding: 10px;
  display: grid;
  grid-template-columns: repeat(2, minmax(210px, 1fr));
  gap: 2px;
  min-width: 460px;
}
.dropdown-panel a {
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--color-text);
  font-weight: 500;
  font-size: 0.9rem;
  border: none;
}
.dropdown-panel a:hover { background: #f2eefb; color: var(--color-primary); }

@media (max-width: 720px) {
  .nav-dropdown { width: 100%; }
  .nav-dropdown > summary { padding: 12px 14px; }
  .dropdown-panel {
    position: static;
    min-width: 0;
    grid-template-columns: 1fr;
    margin: 4px 0 8px;
    box-shadow: none;
  }
}
