/* ===== RESET & BASE ===== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary: #1a73e8;
  --primary-dark: #1557b0;
  --secondary: #34a853;
  --text: #202124;
  --text-light: #5f6368;
  --bg: #ffffff;
  --bg-light: #f8f9fa;
  --bg-card: #ffffff;
  --border: #dadce0;
  --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 25px rgba(0,0,0,0.1);
  --radius: 8px;
  --max-width: 1200px;
  --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg-light);
  line-height: 1.7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color 0.2s;
}

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

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

ul, ol {
  padding-left: 1.5em;
}

/* ===== HEADER ===== */
.site-header {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: var(--shadow);
}

.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.logo {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

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

.nav-menu {
  display: flex;
  list-style: none;
  gap: 0.25rem;
  padding: 0;
}

.nav-menu a {
  display: block;
  padding: 0.5rem 1rem;
  color: var(--text-light);
  font-weight: 500;
  font-size: 0.938rem;
  border-radius: var(--radius);
  transition: all 0.2s;
}

.nav-menu a:hover,
.nav-menu a.active {
  color: var(--primary);
  background: rgba(26, 115, 232, 0.08);
}

.menu-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  color: var(--text);
}

.menu-toggle svg {
  width: 24px;
  height: 24px;
}

/* ===== HERO ===== */
.hero {
  background: linear-gradient(135deg, var(--primary) 0%, #4285f4 50%, var(--secondary) 100%);
  color: #fff;
  padding: 4rem 1.5rem;
  text-align: center;
}

.hero h1 {
  font-size: 2.5rem;
  font-weight: 800;
  margin-bottom: 1rem;
  line-height: 1.2;
}

.hero p {
  font-size: 1.15rem;
  opacity: 0.92;
  max-width: 600px;
  margin: 0 auto 2rem;
}

.hero-search {
  max-width: 500px;
  margin: 0 auto;
  position: relative;
}

.hero-search input {
  width: 100%;
  padding: 0.875rem 1.25rem 0.875rem 3rem;
  border: none;
  border-radius: 50px;
  font-size: 1rem;
  box-shadow: var(--shadow-lg);
  outline: none;
}

.hero-search svg {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  color: var(--text-light);
}

/* ===== MAIN LAYOUT ===== */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

.main-grid {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 2rem;
  align-items: start;
}

main {
  flex: 1;
}

/* ===== ARTICLE CARDS ===== */
.section-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 3px solid var(--primary);
  display: inline-block;
}

.posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
}

.post-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.2s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
}

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

.post-card-image {
  width: 100%;
  height: 200px;
  object-fit: cover;
  background: linear-gradient(135deg, #e8eaf6, #c5cae9);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  font-size: 3rem;
  font-weight: 700;
}

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

.post-card-category {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--primary);
  background: rgba(26, 115, 232, 0.1);
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.5rem;
  width: fit-content;
}

.post-card-title {
  font-size: 1.125rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  line-height: 1.4;
}

.post-card-title a {
  color: var(--text);
}

.post-card-title a:hover {
  color: var(--primary);
}

.post-card-excerpt {
  font-size: 0.9rem;
  color: var(--text-light);
  margin-bottom: 1rem;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-card-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.8rem;
  color: var(--text-light);
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.post-card-meta svg {
  width: 14px;
  height: 14px;
  vertical-align: -2px;
  margin-right: 0.25rem;
}

/* ===== SIDEBAR ===== */
.sidebar {
  position: sticky;
  top: 80px;
}

.sidebar-widget {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow);
}

.sidebar-widget h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--primary);
}

.sidebar-widget ul {
  list-style: none;
  padding: 0;
}

.sidebar-widget ul li {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}

.sidebar-widget ul li:last-child {
  border-bottom: none;
}

.sidebar-widget ul li a {
  color: var(--text);
  font-size: 0.9rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.sidebar-widget ul li a:hover {
  color: var(--primary);
}

.category-count {
  background: var(--bg-light);
  padding: 0.1rem 0.5rem;
  border-radius: 10px;
  font-size: 0.8rem;
  color: var(--text-light);
}

/* Ad placeholder */
.ad-placeholder {
  background: var(--bg-light);
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 2rem 1rem;
  text-align: center;
  color: var(--text-light);
  font-size: 0.85rem;
  margin-bottom: 1.5rem;
}

/* ===== SINGLE POST ===== */
.post-content {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 2.5rem;
  box-shadow: var(--shadow);
  margin-bottom: 2rem;
}

.post-header {
  margin-bottom: 2rem;
}

.post-header h1 {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1.3;
  margin-bottom: 1rem;
}

.post-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  color: var(--text-light);
  font-size: 0.9rem;
}

.post-meta svg {
  width: 16px;
  height: 16px;
  vertical-align: -3px;
  margin-right: 0.25rem;
}

.post-body h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 2rem 0 1rem;
  color: var(--text);
}

.post-body h3 {
  font-size: 1.2rem;
  font-weight: 600;
  margin: 1.5rem 0 0.75rem;
}

.post-body p {
  margin-bottom: 1.15rem;
}

.post-body ul, .post-body ol {
  margin-bottom: 1.15rem;
}

.post-body li {
  margin-bottom: 0.4rem;
}

.post-body strong {
  color: var(--text);
}

.post-body blockquote {
  border-left: 4px solid var(--primary);
  padding: 1rem 1.5rem;
  margin: 1.5rem 0;
  background: var(--bg-light);
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--text-light);
  font-style: italic;
}

.post-body code {
  background: var(--bg-light);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-size: 0.9em;
  color: #d63384;
}

.post-body pre {
  background: #1e1e1e;
  color: #d4d4d4;
  padding: 1.25rem;
  border-radius: var(--radius);
  overflow-x: auto;
  margin: 1.5rem 0;
}

.post-body pre code {
  background: none;
  color: inherit;
  padding: 0;
}

.post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.tag {
  display: inline-block;
  padding: 0.3rem 0.75rem;
  background: var(--bg-light);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 0.8rem;
  color: var(--text-light);
  transition: all 0.2s;
}

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

/* In-article ad */
.in-article-ad {
  background: var(--bg-light);
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-align: center;
  color: var(--text-light);
  font-size: 0.85rem;
  margin: 2rem 0;
}

/* ===== BREADCRUMB ===== */
.breadcrumb {
  padding: 1rem 0;
  font-size: 0.875rem;
  color: var(--text-light);
}

.breadcrumb a {
  color: var(--text-light);
}

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

.breadcrumb span {
  margin: 0 0.4rem;
}

/* ===== PAGE CONTENT ===== */
.page-content {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 2.5rem;
  box-shadow: var(--shadow);
  margin-bottom: 2rem;
}

.page-content h1 {
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 1.5rem;
  color: var(--text);
}

.page-content h2 {
  font-size: 1.4rem;
  font-weight: 700;
  margin: 2rem 0 1rem;
}

.page-content h3 {
  font-size: 1.15rem;
  font-weight: 600;
  margin: 1.5rem 0 0.75rem;
}

.page-content p {
  margin-bottom: 1rem;
  color: var(--text);
}

.page-content ul, .page-content ol {
  margin-bottom: 1rem;
}

.page-content li {
  margin-bottom: 0.35rem;
}

/* ===== CONTACT FORM ===== */
.contact-form {
  max-width: 600px;
}

.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.4rem;
  font-size: 0.9rem;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-family: var(--font);
  transition: border-color 0.2s;
  background: var(--bg);
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.15);
}

.form-group textarea {
  min-height: 150px;
  resize: vertical;
}

.btn {
  display: inline-block;
  padding: 0.75rem 2rem;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

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

/* ===== PAGINATION ===== */
.pagination {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 2rem;
}

.pagination a, .pagination span {
  display: inline-block;
  padding: 0.5rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-weight: 500;
  font-size: 0.9rem;
}

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

.pagination .current {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* ===== FOOTER ===== */
.site-footer {
  background: #1a1a2e;
  color: #ccc;
  margin-top: auto;
}

.footer-grid {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 3rem 1.5rem 2rem;
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 2rem;
}

.footer-col h4 {
  color: #fff;
  font-size: 1.05rem;
  margin-bottom: 1rem;
}

.footer-col p {
  font-size: 0.9rem;
  line-height: 1.6;
  color: #aaa;
}

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

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

.footer-col ul li a {
  color: #aaa;
  font-size: 0.9rem;
  transition: color 0.2s;
}

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

.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.1);
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1.25rem 1.5rem;
  text-align: center;
  font-size: 0.85rem;
  color: #888;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 968px) {
  .main-grid {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

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

@media (max-width: 768px) {
  .nav-menu {
    display: none;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: var(--bg);
    flex-direction: column;
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
  }

  .nav-menu.active {
    display: flex;
  }

  .menu-toggle {
    display: block;
  }

  .hero h1 {
    font-size: 1.75rem;
  }

  .hero {
    padding: 2.5rem 1rem;
  }

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

  .post-content, .page-content {
    padding: 1.5rem;
  }

  .post-header h1, .page-content h1 {
    font-size: 1.5rem;
  }

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

@media (max-width: 480px) {
  .header-inner {
    padding: 0 1rem;
  }

  .hero h1 {
    font-size: 1.5rem;
  }

  .container {
    padding: 1.5rem 1rem;
  }
}

/* ===== READING PROGRESS BAR ===== */
.reading-progress {
  position: fixed;
  top: 64px;
  left: 0;
  width: 0%;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  z-index: 999;
  transition: width 0.1s linear;
}

/* ===== COOKIE CONSENT BANNER ===== */
.cookie-consent {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #1a1a2e;
  color: #ddd;
  padding: 1.25rem 1.5rem;
  z-index: 10000;
  box-shadow: 0 -4px 12px rgba(0,0,0,0.15);
  display: none;
}

.cookie-consent.show {
  display: block;
}

.cookie-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.cookie-inner p {
  font-size: 0.9rem;
  line-height: 1.5;
  flex: 1;
  min-width: 280px;
}

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

.cookie-buttons {
  display: flex;
  gap: 0.75rem;
  flex-shrink: 0;
}

.cookie-btn {
  padding: 0.5rem 1.5rem;
  border: none;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.cookie-btn.accept {
  background: var(--primary);
  color: #fff;
}

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

.cookie-btn.decline {
  background: transparent;
  color: #ccc;
  border: 1px solid #555;
}

.cookie-btn.decline:hover {
  border-color: #999;
  color: #fff;
}

/* ===== NEWSLETTER SIGNUP ===== */
.newsletter-widget {
  background: linear-gradient(135deg, var(--primary), #4285f4);
  border-radius: var(--radius);
  padding: 1.75rem;
  margin-bottom: 1.5rem;
  color: #fff;
  text-align: center;
}

.newsletter-widget h3 {
  color: #fff;
  border-bottom: none;
  margin-bottom: 0.5rem;
  font-size: 1.1rem;
}

.newsletter-widget p {
  font-size: 0.85rem;
  opacity: 0.9;
  margin-bottom: 1rem;
}

.newsletter-form {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.newsletter-form input {
  padding: 0.65rem 1rem;
  border: none;
  border-radius: var(--radius);
  font-size: 0.9rem;
  outline: none;
}

.newsletter-form button {
  padding: 0.65rem;
  border: none;
  border-radius: var(--radius);
  background: #fff;
  color: var(--primary);
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
}

.newsletter-form button:hover {
  background: #e8eaf6;
}

.newsletter-success {
  display: none;
  padding: 0.75rem;
  background: rgba(255,255,255,0.2);
  border-radius: var(--radius);
  font-size: 0.9rem;
}

/* ===== SOCIAL SHARE ===== */
.share-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 0;
  margin: 1.5rem 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.share-bar span {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text);
}

.share-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  color: #fff;
  transition: transform 0.2s, opacity 0.2s;
}

.share-btn:hover {
  transform: scale(1.1);
  opacity: 0.9;
  color: #fff;
}

.share-btn.facebook { background: #1877f2; }
.share-btn.twitter { background: #1da1f2; }
.share-btn.linkedin { background: #0a66c2; }
.share-btn.whatsapp { background: #25d366; }
.share-btn.copy-link { background: var(--text-light); }

.share-btn svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.copy-tooltip {
  position: absolute;
  background: var(--text);
  color: #fff;
  padding: 0.3rem 0.6rem;
  border-radius: 4px;
  font-size: 0.75rem;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.copy-tooltip.show {
  opacity: 1;
}

/* ===== BACK TO TOP ===== */
.back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 44px;
  height: 44px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s;
  z-index: 100;
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
}

.back-to-top:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
}

.back-to-top svg {
  width: 20px;
  height: 20px;
}

/* ===== TABLE OF CONTENTS (in articles) ===== */
.toc-widget {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow);
  border-left: 3px solid var(--primary);
}

.toc-widget h3 {
  font-size: 0.95rem;
  margin-bottom: 0.75rem;
  color: var(--text);
}

.toc-widget ol {
  padding-left: 1.25rem;
}

.toc-widget li {
  margin-bottom: 0.35rem;
  font-size: 0.85rem;
}

.toc-widget a {
  color: var(--text-light);
}

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

@media (max-width: 768px) {
  .cookie-inner {
    flex-direction: column;
    text-align: center;
  }

  .share-bar {
    flex-wrap: wrap;
  }

  .back-to-top {
    bottom: 1rem;
    right: 1rem;
  }
}
