@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@600;700&family=Inter:wght@400;500;600;700&display=swap');

:root {
  --bg: #f8fafc;
  --bg-card: #ffffff;
  --bg-elevated: #f1f5f9;
  --text: #0f172a;
  --text-muted: #64748b;
  --primary: #0ea5e9;
  --primary-dark: #0284c7;
  --accent: #8b5cf6;
  --border: #e2e8f0;
  --shadow: 0 10px 40px rgba(15, 23, 42, 0.08);
  --radius: 16px;
  --font: 'Inter', system-ui, sans-serif;
  --display: 'Playfair Display', Georgia, serif;
  --nav-h: 72px;
}

[data-theme="dark"] {
  --bg: #0b1120;
  --bg-card: #131c31;
  --bg-elevated: #1a2540;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --border: #1e293b;
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  transition: background 0.3s, color 0.3s;
}

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

.container {
  width: min(1140px, calc(100% - 32px));
  margin: 0 auto;
}

/* ── Header ── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 900;
  background: rgba(248, 250, 252, 0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  height: var(--nav-h);
  transition: background 0.3s;
}

[data-theme="dark"] .site-header {
  background: rgba(11, 17, 32, 0.92);
}

.header-inner {
  height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.logo {
  font-family: var(--display);
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
}

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

.main-nav {
  display: flex;
  align-items: center;
  gap: 28px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.main-nav a {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  transition: color 0.2s;
}

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

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

.icon-btn {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: border-color 0.2s, background 0.2s;
}

.icon-btn:hover { border-color: var(--primary); color: var(--primary); }

.nav-toggle { display: none; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: transform 0.2s, background 0.2s;
  font-family: var(--font);
}

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

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  box-shadow: 0 8px 24px rgba(14, 165, 233, 0.3);
}

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--text);
}

/* ── Hero carousel ── */
.hero-carousel {
  position: relative;
  overflow: hidden;
  border-radius: calc(var(--radius) + 8px);
  margin: 32px auto 0;
  max-width: 1140px;
  width: calc(100% - 32px);
  min-height: 420px;
  background: var(--bg-elevated);
}

.hero-slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.7s ease;
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.hero-slide.active { opacity: 1; position: relative; z-index: 1; }

.hero-slide-content {
  padding: 48px 40px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.hero-slide-content .tag {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--primary);
  margin-bottom: 12px;
}

.hero-slide-content h1 {
  font-family: var(--display);
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  font-weight: 700;
  margin: 0 0 16px;
  line-height: 1.15;
}

.hero-slide-content p {
  color: var(--text-muted);
  margin: 0 0 24px;
  max-width: 420px;
}

.hero-slide-img {
  overflow: hidden;
  min-height: 280px;
}

.hero-slide-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.carousel-dots {
  position: absolute;
  bottom: 20px;
  left: 40px;
  display: flex;
  gap: 8px;
  z-index: 10;
}

.carousel-dots button {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: none;
  background: var(--border);
  cursor: pointer;
  padding: 0;
  transition: background 0.2s, transform 0.2s;
}

.carousel-dots button.active {
  background: var(--primary);
  transform: scale(1.2);
}

/* ── Stats bar ── */
.stats-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin: 40px auto;
  max-width: 1140px;
  width: calc(100% - 32px);
}

.stat-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  transition: transform 0.25s, box-shadow 0.25s;
}

.stat-box:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}

.stat-box strong {
  display: block;
  font-family: var(--display);
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
  line-height: 1;
}

.stat-box span {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
  display: block;
}

/* ── Tabs section ── */
.tabs-section { padding: 20px 0 60px; }

.tabs-nav {
  display: flex;
  gap: 8px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}

.tab-btn {
  padding: 10px 22px;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: var(--bg-card);
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s;
}

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

.tab-panel { display: none; animation: fadeIn 0.4s ease; }
.tab-panel.active { display: block; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.articles-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.article-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.3s, box-shadow 0.3s;
}

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

.article-card img {
  width: 100%;
  height: 180px;
  object-fit: cover;
}

.article-card-body { padding: 22px; }

.article-card .cat {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 8px;
}

.article-card h3 {
  font-family: var(--display);
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0 0 8px;
  line-height: 1.3;
}

.article-card p {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0 0 14px;
}

.article-card .read-more {
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
}

/* ── Tools page ── */
.tools-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  padding: 40px 0 80px;
}

.tool-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
}

.tool-card h2 {
  font-family: var(--display);
  font-size: 1.4rem;
  margin: 0 0 8px;
}

.tool-card > p {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 24px;
}

.tool-form .field {
  margin-bottom: 16px;
}

.tool-form label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-muted);
}

.tool-form input,
.tool-form select {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-family: var(--font);
  font-size: 14px;
  background: var(--bg);
  color: var(--text);
}

.tool-form input:focus,
.tool-form select:focus {
  outline: none;
  border-color: var(--primary);
}

.tool-result {
  margin-top: 20px;
  padding: 20px;
  background: var(--bg-elevated);
  border-radius: 12px;
  display: none;
}

.tool-result.show { display: block; }

.tool-result strong {
  font-size: 1.5rem;
  color: var(--primary);
}

/* ── Article page ── */
.page-hero-sm {
  padding: 48px 0 32px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 40px;
}

.page-hero-sm h1 {
  font-family: var(--display);
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  margin: 0 0 12px;
}

.article-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 40px;
  padding-bottom: 80px;
}

.article-content img.featured {
  width: 100%;
  height: 360px;
  object-fit: cover;
  border-radius: var(--radius);
  margin-bottom: 28px;
}

.article-content p {
  font-size: 16px;
  line-height: 1.85;
  color: var(--text-muted);
  margin-bottom: 18px;
}

.article-content h2 {
  font-family: var(--display);
  font-size: 1.35rem;
  margin: 32px 0 12px;
  color: var(--text);
}

.article-sidebar .widget {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 16px;
  position: sticky;
  top: calc(var(--nav-h) + 20px);
}

.widget-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--primary);
  margin-bottom: 14px;
}

.toc-list { list-style: none; padding: 0; margin: 0; }
.toc-list li { margin-bottom: 8px; }
.toc-list a { font-size: 13px; color: var(--text-muted); }
.toc-list a:hover { color: var(--primary); }

/* ── FAQ accordion ── */
.faq-list { max-width: 720px; }

.faq-item {
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 10px;
  overflow: hidden;
  background: var(--bg-card);
}

.faq-q {
  width: 100%;
  padding: 18px 20px;
  background: none;
  border: none;
  text-align: left;
  font-family: var(--font);
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.faq-q::after {
  content: '+';
  font-size: 1.2rem;
  color: var(--primary);
  transition: transform 0.3s;
}

.faq-item.open .faq-q::after { transform: rotate(45deg); }

.faq-a {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s ease;
}

.faq-a-inner {
  padding: 0 20px 18px;
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.7;
}

.faq-item.open .faq-a { max-height: 200px; }

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal-overlay.show { display: flex; }

.modal-box {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 32px;
  max-width: 480px;
  width: 100%;
  position: relative;
  animation: modalIn 0.3s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--text-muted);
}

/* ── Toast ── */
#toastContainer {
  position: fixed;
  bottom: 100px;
  right: 24px;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  padding: 14px 20px;
  border-radius: 10px;
  box-shadow: var(--shadow);
  font-size: 14px;
  animation: toastIn 0.35s ease;
  max-width: 320px;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ── Progress ring back to top ── */
#backTopRing {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
  z-index: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}

#backTopRing.show { opacity: 1; visibility: visible; }

#backTopRing svg { position: absolute; transform: rotate(-90deg); }
#backTopRing .icon { font-size: 18px; color: var(--primary); }

/* ── Cookie bar ── */
#cookieBar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  padding: 20px 24px;
  z-index: 9999;
  display: none;
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.1);
}

#cookieBar.show { display: block; }

.cookie-inner {
  max-width: 1140px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.cookie-inner p {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
  flex: 1;
  min-width: 260px;
}

.cookie-inner a { color: var(--primary); }

.cookie-btns { display: flex; gap: 10px; }

.cookie-btns button {
  padding: 10px 20px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font);
}

#cookieAccept {
  background: var(--primary);
  color: #fff;
  border: none;
}

#cookieDecline {
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--text-muted);
}

/* ── Search modal input ── */
.search-input {
  width: 100%;
  padding: 14px 18px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  font-size: 16px;
  margin-bottom: 16px;
  background: var(--bg);
  color: var(--text);
}

.search-results a {
  display: block;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

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

/* ── Footer ── */
.site-footer {
  background: var(--bg-elevated);
  border-top: 1px solid var(--border);
  padding: 48px 0 28px;
  margin-top: 40px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 32px;
  margin-bottom: 32px;
}

.footer-grid .logo { margin-bottom: 12px; display: inline-block; }

.footer-grid p { font-size: 13px; color: var(--text-muted); margin: 0; }

.footer-col h4 {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.footer-col ul { list-style: none; padding: 0; margin: 0; }
.footer-col li { margin-bottom: 8px; }
.footer-col a { font-size: 13px; color: var(--text-muted); }
.footer-col a:hover { color: var(--primary); }

.footer-bottom {
  padding-top: 24px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

/* ── Filter chips (topics page) ── */
.filter-chips {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 28px;
}

.chip {
  padding: 8px 18px;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: var(--bg-card);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  font-family: var(--font);
  color: var(--text-muted);
}

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

.topics-grid .article-card.hidden { display: none; }

/* ── Contact ── */
.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  padding: 40px 0 80px;
}

.contact-form .field { margin-bottom: 16px; }

.contact-form input,
.contact-form textarea {
  width: 100%;
  padding: 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-family: var(--font);
  background: var(--bg-card);
  color: var(--text);
}

.contact-form textarea { min-height: 140px; resize: vertical; }

@media (max-width: 992px) {
  .hero-slide { grid-template-columns: 1fr; }
  .hero-slide-img { min-height: 220px; order: -1; }
  .stats-bar { grid-template-columns: repeat(2, 1fr); }
  .articles-grid { grid-template-columns: 1fr 1fr; }
  .tools-grid,
  .article-layout,
  .contact-grid,
  .footer-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .main-nav {
    display: none;
    position: absolute;
    top: var(--nav-h);
    left: 0;
    right: 0;
    background: var(--bg-card);
    flex-direction: column;
    padding: 20px;
    border-bottom: 1px solid var(--border);
  }

  .main-nav.open { display: flex; }
  .nav-toggle { display: flex; }
  .articles-grid { grid-template-columns: 1fr; }
  .stats-bar { grid-template-columns: 1fr; }
}
