@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700;800&family=Outfit:wght@400;500;600;700&display=swap');

/* ─── Design tokens ─── */
:root {
  --bg: #f5f7fa;
  --surface: #ffffff;
  --surface-2: #eef1f6;
  --primary: #1a3a6b;
  --primary-hover: #0f2347;
  --text: #111827;
  --text-muted: #6b7280;
  --border: #e5e7eb;
  --accent: #1a3a6b;
  --accent-light: #dbeafe;
  --shadow: 0 1px 3px rgba(0, 0, 0, .08), 0 4px 16px rgba(0, 0, 0, .06);
  --shadow-hover: 0 4px 12px rgba(0, 0, 0, .12), 0 12px 32px rgba(0, 0, 0, .1);
  --radius: 12px;
  --radius-sm: 8px;
  --navbar-h: 68px;
}

[data-theme="dark"] {
  --bg: #0a0f1e;
  --surface: #111827;
  --surface-2: #1a2235;
  --primary: #60a5fa;
  --primary-hover: #93c5fd;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --border: #1e293b;
  --accent: #60a5fa;
  --accent-light: #1e3a5f;
  --shadow: 0 1px 3px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
  --shadow-hover: 0 4px 12px rgba(0, 0, 0, .4), 0 12px 32px rgba(0, 0, 0, .3);
}

/* ─── Reset ─── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  background: var(--bg);
  color: var(--text);
  transition: background .25s, color .25s;
  min-height: 100vh;
}

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

a {
  color: inherit;
  text-decoration: none;
}

/* ─── Typography ─── */
h1,
h2,
h3,
h4 {
  font-family: 'Montserrat', sans-serif;
  line-height: 1.25;
  font-weight: 700;
  color: var(--text);
}

h1 {
  font-size: clamp(2rem, 5vw, 3.5rem);
}

h2 {
  font-size: clamp(1.5rem, 3.5vw, 2.25rem);
}

h3 {
  font-size: clamp(1.1rem, 2.5vw, 1.4rem);
}

p {
  color: var(--text-muted);
}

#cat-desc {
  font-family: 'Outfit', sans-serif;
}

.sidebar-article h6,
.sidebar-block h5 {
  font-family: 'Outfit', sans-serif;
}

/* ─── Layout ─── */
.section {
  max-width: 1100px;
  margin-inline: auto;
  padding-inline: 1.5rem;
}

.section-block {
  padding-block: 4rem;
}

/* ─── Navbar ─── */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: var(--navbar-h);
  border-bottom: 1px solid transparent;
  transition: background .2s, border-color .2s, backdrop-filter .2s;
}

.navbar.scrolled {
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-color: var(--border);
}

.navbar-inner {
  max-width: 1100px;
  margin-inline: auto;
  padding-inline: 1.5rem;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
}

.nav-logo {
  font-family: 'Outfit', sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: -.5px;
  flex-shrink: 0;
}

.nav-logo span {
  color: var(--text);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.75rem;
  list-style: none;
}

.nav-links a {
  font-size: .9rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: color .15s;
}

.nav-links a:hover {
  color: var(--text);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-shrink: 0;
}

/* theme toggle */
.theme-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: background .2s, border-color .2s;
}

.theme-btn:hover {
  background: var(--surface-2);
}

/* hamburger */
.hamburger {
  display: none;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 5px;
  padding: 9px;
}

.hamburger span {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform .2s, opacity .2s;
}

.hamburger.open span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.hamburger.open span:nth-child(2) {
  opacity: 0;
}

.hamburger.open span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* mobile menu */
.mobile-menu {
  display: none;
  position: fixed;
  top: var(--navbar-h);
  left: 0;
  right: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 1.5rem;
  z-index: 99;
  flex-direction: column;
  gap: 1rem;
  box-shadow: var(--shadow);
}

.mobile-menu.open {
  display: flex;
}

.mobile-menu a {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-muted);
  padding: .5rem 0;
  border-bottom: 1px solid var(--border);
  transition: color .15s;
}

.mobile-menu a:last-child {
  border: none;
}

.mobile-menu a:hover {
  color: var(--text);
}

/* ─── Buttons ─── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .75rem 1.5rem;
  background: var(--primary);
  color: #fff;
  font-family: 'Inter', sans-serif;
  font-size: .9rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background .2s, transform .15s;
  white-space: nowrap;
}

[data-theme="dark"] .btn-primary {
  color: #0a0f1e;
}

.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

[data-theme="dark"] .btn-primary:hover {
  background: var(--primary-hover);
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .75rem 1.5rem;
  background: transparent;
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: .9rem;
  font-weight: 500;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background .2s, border-color .2s;
  white-space: nowrap;
}

.btn-ghost:hover {
  background: var(--surface-2);
  border-color: var(--text-muted);
}

/* ─── Badge ─── */
.badge {
  display: inline-block;
  padding: .2rem .65rem;
  background: var(--accent-light);
  color: var(--primary);
  font-size: .75rem;
  font-weight: 600;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: .04em;
}

/* ─── Hero ─── */
.hero {
  padding-top: calc(var(--navbar-h) + 5rem);
  padding-bottom: 5rem;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 120% 80% at 50% 110%, transparent 0%, var(--bg) 70%);
  z-index: 0;
}

.hero-bg-gradient {
  position: absolute;
  top: -20%;
  left: 50%;
  transform: translateX(-50%);
  width: 900px;
  height: 700px;
  background: radial-gradient(ellipse at center, color-mix(in srgb, var(--primary) 12%, transparent) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

.hero-content {
  position: relative;
  z-index: 1;
}

.hero-label {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .3rem .9rem;
  background: var(--accent-light);
  color: var(--primary);
  font-size: .8rem;
  font-weight: 600;
  border-radius: 999px;
  margin-bottom: 1.5rem;
  border: 1px solid color-mix(in srgb, var(--primary) 20%, transparent);
}

.hero h1 {
  max-width: 700px;
  margin-bottom: 1.25rem;
}

.hero h1 em {
  font-style: normal;
  color: var(--primary);
}

.hero-sub {
  font-size: 1.15rem;
  max-width: 560px;
  margin-bottom: 2.5rem;
  color: var(--text-muted);
}

.hero-ctas {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 4rem;
}

/* hero article preview */
.hero-preview {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-hover);
  max-width: 860px;
}

.hero-preview::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, var(--bg) 0%, transparent 40%);
  z-index: 1;
}

.hero-preview img {
  width: 100%;
  height: 420px;
  object-fit: cover;
  display: block;
  transition: transform .5s;
}

.hero-preview:hover img {
  transform: scale(1.02);
}

.hero-preview-caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 2rem;
  z-index: 2;
}

.hero-preview-caption .badge {
  margin-bottom: .75rem;
}

.hero-preview-caption h3 {
  font-size: clamp(1.1rem, 2.5vw, 1.5rem);
  color: var(--text);
  margin-bottom: .5rem;
}

.hero-preview-caption p {
  font-size: .9rem;
}

/* ─── Section header ─── */
.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 2rem;
  gap: 1rem;
}

.section-header h2 {
  margin: 0;
}

.section-header a {
  font-size: .85rem;
  font-weight: 500;
  color: var(--primary);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: .25rem;
  transition: gap .15s;
}

.section-header a:hover {
  gap: .5rem;
}

/* ─── Card ─── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: transform .2s, box-shadow .2s, border-color .2s;
  display: flex;
  flex-direction: column;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
  border-color: color-mix(in srgb, var(--primary) 30%, var(--border));
}

.card-img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  display: block;
}

.card-body {
  padding: 1.25rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: .6rem;
}

.card-meta {
  display: flex;
  align-items: center;
  gap: .75rem;
  font-size: .78rem;
  color: var(--text-muted);
}

.card-meta .dot {
  opacity: .4;
}

.card h3 {
  font-size: 1.05rem;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card p {
  font-size: .875rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}

.card-link {
  font-size: .82rem;
  font-weight: 600;
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  margin-top: .5rem;
  transition: gap .15s;
}

.card:hover .card-link {
  gap: .5rem;
}

/* ─── Featured (large cards) ─── */
.featured-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 1.25rem;
}

.featured-grid .card-img {
  height: 260px;
}

.featured-grid .card:first-child .card-img {
  height: 320px;
}

.featured-grid .col-right {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.featured-grid .col-right .card-img {
  height: 145px;
}

/* ─── Latest grid ─── */
.latest-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}

/* ─── Categories ─── */
.categories-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

.cat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem 1.25rem;
  cursor: pointer;
  transition: transform .2s, box-shadow .2s, border-color .2s, background .2s;
  text-align: center;
}

.cat-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
  border-color: var(--primary);
  background: var(--accent-light);
}

.cat-icon {
  font-size: 2rem;
  margin-bottom: .75rem;
}

.cat-card h4 {
  font-family: 'Inter', sans-serif;
  font-size: .9rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: .35rem;
}

.cat-card p {
  font-size: .78rem;
  color: var(--text-muted);
}

/* ─── Divider ─── */
.divider {
  height: 1px;
  background: var(--border);
  margin: 0;
}

/* ─── Footer ─── */
.footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding-top: 4rem;
  padding-bottom: 2rem;
  margin-top: 5rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 2.5rem;
  margin-bottom: 3rem;
}

.footer-brand .nav-logo {
  font-size: 1.75rem;
  display: inline-block;
  margin-bottom: 1rem;
}

.footer-brand p {
  font-size: .9rem;
  max-width: 280px;
  margin-bottom: 1.5rem;
}

.social-links {
  display: flex;
  gap: .75rem;
}

.social-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: .9rem;
  transition: background .2s, color .2s, border-color .2s;
}

.social-link:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

[data-theme="dark"] .social-link:hover {
  color: #0a0f1e;
}

.footer-col h5 {
  font-family: 'Inter', sans-serif;
  font-size: .85rem;
  font-weight: 700;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 1.25rem;
}

.footer-col ul {
  list-style: none;
}

.footer-col li {
  margin-bottom: .6rem;
}

.footer-col a {
  font-size: .88rem;
  color: var(--text-muted);
  transition: color .15s;
}

.footer-col a:hover {
  color: var(--primary);
}

.footer-bottom {
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.footer-bottom p {
  font-size: .82rem;
  color: var(--text-muted);
}

.footer-bottom a {
  color: var(--primary);
  font-weight: 500;
  transition: opacity .15s;
}

.footer-bottom a:hover {
  opacity: .75;
}

/* ─── Article page ─── */
.page-header {
  padding-top: calc(var(--navbar-h) + 3rem);
  padding-bottom: 3rem;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .82rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.breadcrumb a {
  transition: color .15s;
}

.breadcrumb a:hover {
  color: var(--primary);
}

.breadcrumb .sep {
  opacity: .4;
}

.article-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.article-meta .dot {
  opacity: .3;
  color: var(--text-muted);
}

.article-meta span {
  font-size: .85rem;
  color: var(--text-muted);
}

.article-title {
  max-width: 820px;
  margin-bottom: 1rem;
}

.article-excerpt {
  font-size: 1.1rem;
  max-width: 680px;
  color: var(--text-muted);
  line-height: 1.7;
}

.article-img {
  width: 100%;
  max-height: 480px;
  object-fit: cover;
  border-radius: var(--radius);
  margin-bottom: 2.5rem;
}

.article-body {
  max-width: 720px;
}

.article-body p {
  color: var(--text);
  font-size: 1.05rem;
  line-height: 1.85;
  margin-bottom: 1.5rem;
}

.article-body h2 {
  font-size: 1.5rem;
  margin-top: 2.5rem;
  margin-bottom: 1rem;
}

.article-body h3 {
  font-size: 1.2rem;
  margin-top: 2rem;
  margin-bottom: .75rem;
}

.article-body blockquote {
  border-left: 4px solid var(--primary);
  padding: 1rem 1.5rem;
  margin: 2rem 0;
  background: var(--accent-light);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.article-body blockquote p {
  font-style: italic;
  font-size: 1.1rem;
  color: var(--text);
  margin: 0;
}

.article-body ul,
.article-body ol {
  padding-left: 1.5rem;
  margin-bottom: 1.5rem;
}

.article-body li {
  color: var(--text);
  font-size: 1.05rem;
  line-height: 1.8;
  margin-bottom: .4rem;
}

/* article layout */
.article-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 4rem;
  align-items: start;
  padding-bottom: 5rem;
}

.article-sidebar {
  position: sticky;
  top: calc(var(--navbar-h) + 1.5rem);
}

.sidebar-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}

.sidebar-block h5 {
  font-family: 'Outfit', sans-serif;
  font-size: .8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.sidebar-article {
  display: flex;
  gap: .75rem;
  padding: .75rem 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: opacity .15s;
}

.sidebar-article:last-child {
  border: none;
  padding-bottom: 0;
}

.sidebar-article:hover {
  opacity: .8;
}

.sidebar-article img {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.sidebar-article h6 {
  font-family: 'Outfit', sans-serif;
  font-size: .85rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ─── Category page ─── */
.cat-page-header {
  padding-top: calc(var(--navbar-h) + 3rem);
  padding-bottom: 3rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 3rem;
}

.cat-tabs {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  margin-top: 2rem;
}

.cat-tab {
  padding: .4rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-size: .85rem;
  font-weight: 500;
  cursor: pointer;
  transition: background .2s, color .2s, border-color .2s;
  font-family: 'Inter', sans-serif;
}

.cat-tab:hover,
.cat-tab.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

[data-theme="dark"] .cat-tab:hover,
[data-theme="dark"] .cat-tab.active {
  color: #0a0f1e;
}

/* ─── Empty state ─── */
.empty-state {
  text-align: center;
  padding: 5rem 1rem;
  color: var(--text-muted);
}

.empty-state p {
  font-size: 1.1rem;
}

/* ─── Animations ─── */
@keyframes fadeSlideUp {
  from {
    opacity: 0;
    transform: translateY(20px) blur(8px);
    filter: blur(6px);
  }

  to {
    opacity: 1;
    transform: translateY(0) blur(0);
    filter: blur(0);
  }
}

.animate-hero>* {
  opacity: 0;
  animation: fadeSlideUp .8s cubic-bezier(.16, 1, .3, 1) forwards;
}

.animate-hero>*:nth-child(1) {
  animation-delay: .1s;
}

.animate-hero>*:nth-child(2) {
  animation-delay: .25s;
}

.animate-hero>*:nth-child(3) {
  animation-delay: .4s;
}

.animate-hero>*:nth-child(4) {
  animation-delay: .55s;
}

.animate-hero>*:nth-child(5) {
  animation-delay: .7s;
}

/* ─── Responsive ─── */
@media (max-width: 900px) {
  .nav-links {
    display: none;
  }

  .hamburger {
    display: flex;
  }

  .featured-grid {
    grid-template-columns: 1fr;
  }

  .featured-grid .col-right {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .featured-grid .col-right .card-img {
    height: 180px;
  }

  .latest-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .categories-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }

  .article-layout {
    grid-template-columns: 1fr;
  }

  .article-sidebar {
    position: static;
  }
}

@media (max-width: 580px) {
  .featured-grid .col-right {
    grid-template-columns: 1fr;
  }

  .latest-grid {
    grid-template-columns: 1fr;
  }

  .categories-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .footer-grid {
    grid-template-columns: 1fr;
  }

  .hero-ctas {
    flex-direction: column;
  }

  .footer-bottom {
    flex-direction: column;
    text-align: center;
  }
}