:root {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-muted: #f8fafc;
  --text: #182230;
  --text-soft: #4b5b70;
  --line: #d9e2ee;
  --primary: #2f6fed;
  --primary-dark: #2558bc;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 6px 16px rgba(20, 35, 60, 0.08);
  --shadow-md: 0 14px 34px rgba(20, 35, 60, 0.12);
  --max-width: 1140px;
  --font: "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
}

body.dark-mode {
  --bg: #0d1522;
  --surface: #151f30;
  --surface-muted: #1a263a;
  --text: #e7edf7;
  --text-soft: #b5c4d8;
  --line: #2c3a50;
  --primary: #66a3ff;
  --primary-dark: #4f86dc;
  --shadow-sm: 0 8px 18px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 16px 36px rgba(0, 0, 0, 0.42);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(circle at 15% 10%, rgba(47, 111, 237, 0.12), transparent 34%),
    radial-gradient(circle at 85% 15%, rgba(47, 111, 237, 0.1), transparent 30%),
    linear-gradient(180deg, #f8fbff 0%, var(--bg) 40%, #eef4fa 100%);
  line-height: 1.6;
  transition: color 0.28s ease, background 0.28s ease;
}

body.dark-mode {
  background:
    radial-gradient(circle at 15% 10%, rgba(102, 163, 255, 0.18), transparent 34%),
    radial-gradient(circle at 85% 15%, rgba(102, 163, 255, 0.12), transparent 30%),
    linear-gradient(180deg, #0f1a2b 0%, var(--bg) 45%, #0a121f 100%);
}

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

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

.container {
  width: min(var(--max-width), 92%);
  margin: 0 auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(10px);
  background: rgba(248, 251, 255, 0.8);
  border-bottom: 1px solid rgba(217, 226, 238, 0.7);
  transition: background 0.28s ease, border-color 0.28s ease;
}

body.dark-mode .site-header {
  background: rgba(13, 21, 34, 0.88);
  border-bottom: 1px solid rgba(44, 58, 80, 0.8);
}

.nav-wrap {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  min-height: 72px;
  gap: 12px;
}

.brand {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

.brand-logo {
  width: min(156px, 38vw);
  max-width: 156px;
  height: auto;
  object-fit: contain;
  transition: filter 0.3s ease, opacity 0.3s ease;
}

/* Optional advanced support: drop-in alternate assets with these classes. */
.brand-logo-light,
.brand-logo-dark {
  width: min(156px, 38vw);
  max-width: 156px;
  height: auto;
  object-fit: contain;
}

.brand-logo-dark {
  display: none;
}

body.dark-mode .brand-logo {
  filter: brightness(1.16) contrast(1.1) drop-shadow(0 0 10px rgba(102, 163, 255, 0.26));
}

body.dark-mode .brand-logo-light {
  display: none;
}

body.dark-mode .brand-logo-dark {
  display: block;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-left: 4px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.search-wrap {
  position: relative;
}

.search-input {
  width: min(280px, 42vw);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  border-radius: 999px;
  min-height: 40px;
  padding: 10px 14px;
  font-size: 0.92rem;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(47, 111, 237, 0.16);
}

.theme-toggle {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  min-height: 40px;
  padding: 8px 11px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 1rem;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.theme-toggle:hover {
  transform: translateY(-1px);
  border-color: var(--primary);
}

.main-nav a {
  color: var(--text-soft);
  font-weight: 600;
  font-size: 0.95rem;
  transition: color 0.2s ease;
}

.main-nav a:hover,
.main-nav a.active {
  color: var(--primary);
}

.nav-cta {
  border: 1px solid var(--primary);
  color: var(--primary);
  padding: 8px 14px;
  border-radius: 999px;
}

.nav-toggle {
  display: none;
  border: 0;
  background: transparent;
  cursor: pointer;
  padding: 8px;
}

.nav-toggle-line {
  display: block;
  width: 23px;
  height: 2px;
  margin: 4px 0;
  background: var(--text);
}

.hero {
  padding: 86px 0 56px;
}

.hero-panel {
  background: linear-gradient(145deg, #ffffff 0%, #f2f7ff 100%);
  border: 1px solid #dde8fa;
  border-radius: 22px;
  box-shadow: var(--shadow-md);
  padding: clamp(28px, 5vw, 58px);
  transition: background 0.28s ease, border-color 0.28s ease;
}

body.dark-mode .hero-panel {
  background: linear-gradient(145deg, #16243a 0%, #132035 100%);
  border-color: #2d3b51;
}

.hero-kicker {
  display: inline-block;
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--primary);
  background: rgba(47, 111, 237, 0.1);
  border: 1px solid rgba(47, 111, 237, 0.2);
  padding: 6px 10px;
  border-radius: 999px;
  font-weight: 700;
}

.hero h1 {
  margin: 14px 0 12px;
  font-size: clamp(2rem, 4.7vw, 3.3rem);
  line-height: 1.16;
}

.hero p {
  margin: 0;
  color: var(--text-soft);
  font-size: clamp(1rem, 2vw, 1.22rem);
  max-width: 65ch;
}

.hero-actions {
  margin-top: 24px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 43px;
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-weight: 700;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 8px 18px rgba(47, 111, 237, 0.28);
}

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-secondary {
  background: var(--surface);
  border-color: var(--line);
  color: var(--text);
}

.section {
  padding: 30px 0 12px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 10px;
  margin-bottom: 16px;
}

.section h2 {
  margin: 0;
  font-size: clamp(1.5rem, 3vw, 2.1rem);
}

.section-subtitle {
  margin: 0;
  color: var(--text-soft);
  max-width: 75ch;
}

.grid {
  display: grid;
  gap: 16px;
}

.grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.card {
  background: var(--surface);
  border: 1px solid #dce6f4;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: transform 0.2s ease, box-shadow 0.25s ease, border-color 0.25s ease, background 0.25s ease;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.card h3,
.card h4 {
  margin: 0;
  line-height: 1.3;
}

.card p {
  margin: 0;
  color: var(--text-soft);
}

.card-footer {
  margin-top: auto;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.post-card {
  overflow: hidden;
  padding: 0;
  gap: 0;
}

.post-card-media {
  display: block;
  aspect-ratio: 1200 / 630;
  overflow: hidden;
  background: var(--surface-muted);
}

.post-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.28s ease;
}

.post-card:hover .post-card-media img {
  transform: scale(1.03);
}

.post-card-body {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  height: 100%;
}

.post-card-body .btn {
  margin-top: auto;
}

.tool-card {
  overflow: hidden;
  padding: 0;
  gap: 0;
}

.tool-card-media {
  aspect-ratio: 1200 / 630;
  overflow: hidden;
  background: var(--surface-muted);
}

.tool-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.28s ease;
}

.tool-card:hover .tool-card-media img {
  transform: scale(1.03);
}

.tool-card-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  height: 100%;
}

.tool-card-body > .btn {
  margin-top: auto;
  align-self: flex-start;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.chip {
  display: inline-flex;
  align-items: center;
  background: var(--surface);
  color: var(--text-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  font-weight: 600;
  font-size: 0.9rem;
}

.top-picks {
  background: linear-gradient(180deg, rgba(47, 111, 237, 0.08), rgba(255, 255, 255, 0));
  border: 1px solid #dce7fa;
  border-radius: 20px;
  padding: 20px;
}

body.dark-mode .top-picks {
  background: linear-gradient(180deg, rgba(102, 163, 255, 0.15), rgba(13, 21, 34, 0));
  border-color: #33445e;
}

.affiliate-btn {
  border: 1px dashed var(--primary);
  color: var(--primary);
  background: rgba(47, 111, 237, 0.08);
}

.article-layout {
  display: grid;
  grid-template-columns: minmax(0, 2.2fr) minmax(220px, 1fr);
  gap: 20px;
}

.article-content {
  background: var(--surface);
  border: 1px solid #dce6f4;
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
  padding: clamp(20px, 3vw, 36px);
}

.article-content h1,
.article-content h2,
.article-content h3 {
  line-height: 1.3;
}

.article-content h1 {
  margin-top: 0;
}

.article-content p,
.article-content li {
  color: var(--text-soft);
}

.article-hero-image {
  margin: 16px 0 20px;
  border: 1px solid #dce6f4;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.article-hero-image img {
  width: 100%;
  aspect-ratio: 1200 / 630;
  object-fit: cover;
}

.article-content ul,
.article-content ol {
  padding-left: 20px;
}

.aside-box {
  position: sticky;
  top: 94px;
  align-self: start;
  background: var(--surface);
  border: 1px solid #dce6f4;
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
  padding: 16px;
}

.site-footer {
  margin-top: 44px;
  background: #0f1c2d;
  color: #cbd7e7;
}

body.dark-mode .site-footer {
  background: #0a121f;
}

.footer-inner {
  padding: 24px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.footer-links a:hover {
  color: #fff;
}

.muted {
  color: var(--text-soft);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.search-result-hidden {
  display: none !important;
}

.match-highlight {
  background: rgba(47, 111, 237, 0.2);
  color: inherit;
  padding: 0 2px;
  border-radius: 3px;
}

body.dark-mode .match-highlight {
  background: rgba(102, 163, 255, 0.3);
}

.search-empty {
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px dashed var(--line);
  border-radius: var(--radius-sm);
  color: var(--text-soft);
  background: var(--surface);
}

@media (max-width: 980px) {
  .grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

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

  .aside-box {
    position: static;
  }
}

@media (max-width: 760px) {
  .header-actions {
    margin-left: auto;
  }

  .brand-logo,
  .brand-logo-light,
  .brand-logo-dark {
    width: min(148px, 45vw);
  }

  .search-wrap {
    display: none;
  }

  .nav-toggle {
    display: block;
  }

  .main-nav {
    position: absolute;
    top: 72px;
    left: 0;
    right: 0;
    background: rgba(250, 252, 255, 0.97);
    border-bottom: 1px solid var(--line);
    display: none;
    flex-direction: column;
    align-items: flex-start;
    padding: 14px 4%;
    gap: 12px;
  }

  body.dark-mode .main-nav {
    background: rgba(13, 21, 34, 0.98);
  }

  .main-nav.open {
    display: flex;
  }

  .grid-4,
  .grid-3 {
    grid-template-columns: 1fr;
  }

  .hero {
    padding-top: 66px;
  }
}
