/* ============================================
   InsightfulBits — Modern Clean Blog Stylesheet
   ============================================ */

/* --- CSS Variables --- */
:root {
  --color-bg: #ffffff;
  --color-bg-alt: #f8f9fa;
  --color-text: #1a1a2e;
  --color-text-muted: #6c757d;
  --color-primary: #2563eb;
  --color-primary-dark: #1d4ed8;
  --color-accent: #f59e0b;
  --color-border: #e5e7eb;
  --color-card: #ffffff;
  --color-footer: #111827;
  --color-footer-text: #d1d5db;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-serif: 'Merriweather', Georgia, 'Times New Roman', serif;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.04);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --max-width: 1100px;
  --max-width-content: 720px;
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.7;
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
}

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

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

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

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-sans);
  line-height: 1.3;
  color: var(--color-text);
  font-weight: 700;
}

h1 { font-size: 2.5rem; letter-spacing: -0.02em; }
h2 { font-size: 1.875rem; letter-spacing: -0.01em; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }

p { margin-bottom: 1.25rem; }
p:last-child { margin-bottom: 0; }

ul, ol { margin-bottom: 1.25rem; padding-left: 1.5rem; }
li { margin-bottom: 0.5rem; }

/* --- Container --- */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

.container--narrow { max-width: var(--max-width-content); }

/* --- Navigation --- */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-border);
}

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

.nav__logo {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--color-text);
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nav__logo-icon {
  width: 32px;
  height: 32px;
  background: var(--color-primary);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1rem;
  font-weight: 800;
}

.nav__links {
  display: flex;
  list-style: none;
  gap: 2rem;
  margin: 0;
  padding: 0;
}

.nav__links a {
  color: var(--color-text-muted);
  font-size: 0.925rem;
  font-weight: 500;
  transition: color 0.2s ease;
  position: relative;
}

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

.nav__links a.active::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--color-primary);
  border-radius: 1px;
}

.nav__toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  flex-direction: column;
  gap: 5px;
}

.nav__toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--color-text);
  border-radius: 1px;
  transition: all 0.3s ease;
}

/* --- Page Header --- */
.page-header {
  background: var(--color-bg-alt);
  border-bottom: 1px solid var(--color-border);
  padding: 3rem 0;
  text-align: center;
}

.page-header h1 { margin-bottom: 0.5rem; }

.page-header p {
  color: var(--color-text-muted);
  font-size: 1.1rem;
  max-width: 550px;
  margin: 0 auto;
}

/* --- Hero Section --- */
.hero {
  padding: 5rem 0 3rem;
  text-align: center;
}

.hero__tag {
  display: inline-block;
  background: #eff6ff;
  color: var(--color-primary);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.35rem 0.9rem;
  border-radius: 100px;
  margin-bottom: 1.5rem;
}

.hero h1 {
  font-size: 3rem;
  max-width: 700px;
  margin: 0 auto 1rem;
}

.hero p {
  font-size: 1.2rem;
  color: var(--color-text-muted);
  max-width: 580px;
  margin: 0 auto 2rem;
}

/* --- Featured Posts Grid --- */
.featured { padding: 3rem 0 5rem; }

.featured h2 {
  text-align: center;
  margin-bottom: 2.5rem;
}

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

/* --- Post Card --- */
.post-card {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  display: flex;
  flex-direction: column;
}

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

.post-card__image {
  width: 100%;
  height: 200px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,0.9);
  font-size: 2.5rem;
}

.post-card__image--green { background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%); }
.post-card__image--orange { background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%); }
.post-card__image--blue { background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%); }
.post-card__image--purple { background: linear-gradient(135deg, #a18cd1 0%, #fbc2eb 100%); }
.post-card__image--dark { background: linear-gradient(135deg, #434343 0%, #000000 100%); }

.post-card__body {
  padding: 1.5rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.post-card__category {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-primary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.5rem;
}

.post-card h3 {
  font-size: 1.2rem;
  margin-bottom: 0.6rem;
  line-height: 1.4;
}

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

.post-card__excerpt {
  color: var(--color-text-muted);
  font-size: 0.95rem;
  margin-bottom: 1rem;
  flex: 1;
}

.post-card__meta {
  font-size: 0.825rem;
  color: var(--color-text-muted);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.post-card__meta span {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

/* --- Content Page --- */
.content-section { padding: 4rem 0; }

.content-section h2 { margin-top: 2.5rem; margin-bottom: 1rem; }
.content-section h3 { margin-top: 2rem; margin-bottom: 0.75rem; }
.content-section ul, .content-section ol { margin-bottom: 1.5rem; }

.content-section blockquote {
  border-left: 4px solid var(--color-primary);
  padding: 1rem 1.5rem;
  margin: 2rem 0;
  background: var(--color-bg-alt);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--color-text-muted);
  font-style: italic;
}

/* --- Article (Blog Post) --- */
.article { padding: 4rem 0; }

.article__meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2rem;
  color: var(--color-text-muted);
  font-size: 0.9rem;
  flex-wrap: wrap;
}

.article__category {
  background: #eff6ff;
  color: var(--color-primary);
  font-weight: 600;
  font-size: 0.8rem;
  padding: 0.25rem 0.75rem;
  border-radius: 100px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.article__content {
  font-family: var(--font-sans);
  font-size: 1.1rem;
  line-height: 1.85;
  color: #374151;
}

.article__content p { margin-bottom: 1.5rem; }

.article__content h2 { margin-top: 2.5rem; margin-bottom: 1rem; font-size: 1.6rem; }
.article__content h3 { margin-top: 2rem; margin-bottom: 0.75rem; font-size: 1.3rem; }
.article__content ul, .article__content ol { margin-bottom: 1.5rem; padding-left: 1.5rem; }
.article__content li { margin-bottom: 0.5rem; }

.article__content blockquote {
  border-left: 4px solid var(--color-primary);
  padding: 1.25rem 1.75rem;
  margin: 2rem 0;
  background: var(--color-bg-alt);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-style: italic;
  color: #4b5563;
}

.article__divider {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: 3rem 0;
}

/* --- Related Posts --- */
.related {
  padding: 2rem 0 5rem;
  background: var(--color-bg-alt);
  border-top: 1px solid var(--color-border);
}

.related h2 { text-align: center; margin-bottom: 2rem; }

/* --- Contact Form --- */
.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  padding: 4rem 0;
}

.contact-info h2 { margin-bottom: 1rem; }
.contact-info p { color: var(--color-text-muted); margin-bottom: 2rem; }

.contact-detail {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.contact-detail__icon {
  width: 44px;
  height: 44px;
  background: #eff6ff;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.contact-detail h4 { font-size: 0.95rem; margin-bottom: 0.2rem; }
.contact-detail span { color: var(--color-text-muted); font-size: 0.9rem; }

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

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

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  background: var(--color-bg);
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

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

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.75rem;
  background: var(--color-primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.1s ease;
  text-decoration: none;
}

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

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

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

/* --- Newsletter CTA --- */
.newsletter-cta {
  background: var(--color-primary);
  color: #fff;
  text-align: center;
  padding: 4rem 1.5rem;
  margin: 0;
}

.newsletter-cta h2 { color: #fff; margin-bottom: 0.75rem; }

.newsletter-cta p {
  color: rgba(255,255,255,0.85);
  max-width: 500px;
  margin: 0 auto 1.75rem;
  font-size: 1.05rem;
}

.newsletter-form {
  display: flex;
  gap: 0.75rem;
  max-width: 460px;
  margin: 0 auto;
}

.newsletter-form input {
  flex: 1;
  padding: 0.75rem 1rem;
  border: 2px solid rgba(255,255,255,0.3);
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.1);
  color: #fff;
  font-family: var(--font-sans);
  font-size: 0.95rem;
}

.newsletter-form input::placeholder { color: rgba(255,255,255,0.6); }

.newsletter-form input:focus {
  outline: none;
  border-color: #fff;
  background: rgba(255,255,255,0.15);
}

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

/* --- Footer --- */
.footer {
  background: var(--color-footer);
  color: var(--color-footer-text);
  padding: 4rem 0 2rem;
}

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

.footer h4 {
  color: #fff;
  margin-bottom: 1rem;
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.footer p { font-size: 0.9rem; line-height: 1.7; margin-bottom: 0.75rem; }

.footer ul { list-style: none; padding: 0; margin: 0; }
.footer ul li { margin-bottom: 0.6rem; }

.footer ul a {
  color: var(--color-footer-text);
  font-size: 0.9rem;
  transition: color 0.2s ease;
}

.footer ul a:hover { color: #fff; }

.footer__bottom {
  border-top: 1px solid rgba(255,255,255,0.1);
  padding-top: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.footer__bottom a { color: var(--color-footer-text); }
.footer__bottom a:hover { color: #fff; }

/* --- Responsive --- */
@media (max-width: 768px) {
  h1 { font-size: 1.9rem; }
  h2 { font-size: 1.5rem; }
  .hero h1 { font-size: 2rem; }

  .nav__links {
    display: none;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: #fff;
    flex-direction: column;
    padding: 1.5rem;
    border-bottom: 1px solid var(--color-border);
    box-shadow: var(--shadow-lg);
    gap: 1rem;
  }

  .nav__links--open { display: flex; }
  .nav__toggle { display: flex; }

  .footer__grid { grid-template-columns: 1fr 1fr; }
  .contact-grid { grid-template-columns: 1fr; }
  .post-grid { grid-template-columns: 1fr; }
  .newsletter-form { flex-direction: column; }

  .page-header { padding: 2rem 0; }
  .content-section { padding: 2.5rem 0; }
  .article { padding: 2.5rem 0; }
}

@media (max-width: 480px) {
  .footer__grid { grid-template-columns: 1fr; }
  .hero { padding: 3rem 0 2rem; }
}
