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

:root {
  /* Brand palette */
  --corpo: #4A90D9;
  --comida: #E67E22;
  --fit: #27AE60;

  /* Extended palette */
  --bg: #f8f9fa;
  --surface: #ffffff;
  --text: #1a1a2e;
  --text-light: #6b7280;
  --text-muted: #9ca3af;
  --accent: #22c55e;
  --accent-dark: #16a34a;
  --border: #e5e7eb;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-hover: 0 4px 12px rgba(0,0,0,0.08);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  --max-width: 720px;
  --max-width-wide: 900px;
  --header-height: 64px;
}

html { scroll-behavior: smooth; }

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

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

img { max-width: 100%; height: auto; border-radius: var(--radius); }

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

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

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

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

.logo {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  text-decoration: none;
}

.logo-img {
  display: block;
  height: 40px;
  width: auto;
  border-radius: 0;
}

.logo:hover { opacity: 0.85; }
.logo:hover .logo-img { border-radius: 0; }

.nav-menu ul {
  display: flex;
  gap: 0.25rem;
  list-style: none;
  align-items: center;
}

.nav-menu a {
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-sm);
  color: var(--text-light);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s;
  white-space: nowrap;
}

.nav-menu a:hover {
  color: var(--text);
  background: var(--bg);
}

.menu-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.25rem;
  color: var(--text);
  line-height: 1;
}

/* === Hero === */
.hero {
  text-align: center;
  padding: 4.5rem 0 3.5rem;
  position: relative;
}

.hero::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 3px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--corpo), var(--comida), var(--fit));
}

.hero h1 {
  font-size: 2.6rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 0.75rem;
  background: linear-gradient(135deg, var(--text) 0%, var(--text) 40%, var(--accent-dark) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p {
  font-size: 1.15rem;
  color: var(--text-light);
  max-width: 540px;
  margin: 0 auto;
  line-height: 1.6;
}

/* === Section Grid (Home) === */
.section-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  margin-top: 1.5rem;
}

.section-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem 1.5rem;
  text-align: center;
  transition: box-shadow 0.25s, transform 0.25s;
  color: var(--text);
  position: relative;
  overflow: hidden;
}

.section-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--card-accent, var(--accent));
}

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

.section-icon {
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
  line-height: 1;
}

.section-card h3 {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.section-card p {
  font-size: 0.9rem;
  color: var(--text-light);
  line-height: 1.6;
  flex: 1;
  margin-bottom: 1rem;
}

.section-cta {
  display: inline-block;
  border-radius: var(--radius-sm);
  padding: 0.5rem 1.25rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: #fff;
  transition: opacity 0.2s, transform 0.2s;
}

.section-card:hover .section-cta {
  opacity: 0.9;
  transform: scale(1.05);
}

/* === Post Section Headers === */
.recent-posts, .section-page {
  margin-top: 2.5rem;
}

.recent-posts h2, .section-page h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* === Post Grid === */
.post-grid {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.post-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem 1.75rem;
  transition: box-shadow 0.25s, transform 0.25s, border-color 0.25s;
}

.post-card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
  border-color: #d1d5db;
}

.post-card h2, .post-card h3 {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  line-height: 1.4;
}

.post-card h2 a, .post-card h3 a {
  color: var(--text);
  transition: color 0.2s;
}

.post-card h2 a:hover, .post-card h3 a:hover {
  color: var(--accent-dark);
}

.post-card p {
  color: var(--text-light);
  font-size: 0.95rem;
  line-height: 1.65;
}

.post-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-light);
  margin-bottom: 0.65rem;
}

.post-meta time {
  font-weight: 600;
  color: var(--text-muted);
}

.post-meta a {
  font-weight: 500;
  font-size: 0.85rem;
}

.post-meta .tags a {
  color: var(--accent);
  font-size: 0.8rem;
}

.read-more {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin-top: 0.75rem;
  font-weight: 600;
  font-size: 0.9rem;
  transition: gap 0.2s;
}

.read-more:hover {
  gap: 0.5rem;
}

/* === Single Post === */
.post-single {
  padding: 2.5rem 0 4rem;
}

.post-header {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.post-header h1 {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 0.75rem;
  line-height: 1.3;
}

.post-content {
  font-size: 1.05rem;
  line-height: 1.85;
  color: #2d2d3f;
}

.post-content h2 {
  font-size: 1.5rem;
  margin: 2.5rem 0 0.75rem;
  font-weight: 700;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid #f0f0f0;
}

.post-content h3 {
  font-size: 1.2rem;
  margin: 1.75rem 0 0.5rem;
  font-weight: 600;
}

.post-content p { margin-bottom: 1.25rem; }

.post-content ul, .post-content ol {
  margin: 0 0 1.25rem 1.5rem;
}

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

.post-content blockquote {
  border-left: 4px solid var(--accent);
  padding: 0.75rem 1.25rem;
  margin: 1.5rem 0;
  background: #f0fdf4;
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--text-light);
}

.post-content code {
  background: var(--bg);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.9em;
}

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

.post-content pre code { background: none; padding: 0; font-size: 0.85rem; }

.post-content hr {
  border: none;
  height: 1px;
  background: var(--border);
  margin: 2rem 0;
}

.post-content img {
  border-radius: var(--radius);
  margin: 1.5rem 0;
}

/* === Terms Grid (Categories / Tags) === */
.terms-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.term-card {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.5rem 1.25rem;
  transition: all 0.2s;
  color: var(--text);
}

.term-card:hover {
  border-color: var(--accent);
  color: var(--accent-dark);
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}

.term-name { font-weight: 600; font-size: 0.95rem; }

.term-count {
  background: var(--bg);
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  color: var(--text-light);
  font-weight: 500;
}

.tags-cloud { gap: 0.5rem; }
.tags-cloud .term-card { border-radius: var(--radius-sm); }

/* === Footer === */
.site-footer {
  margin-top: auto;
  padding: 2.5rem 0 2rem;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.footer-inner {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  max-width: var(--max-width-wide);
  margin: 0 auto;
  padding: 0 1.5rem;
  gap: 1rem;
}

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

.footer-nav {
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.footer-nav a {
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 500;
  transition: color 0.2s;
}

.footer-nav a:hover { color: var(--accent); }

/* === Section Filter / Posts Page === */
.section-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  padding-bottom: 1.25rem;
  border-bottom: 2px solid var(--border);
}

.filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 1.1rem;
  border: 1.5px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-light);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: var(--font);
  white-space: nowrap;
}

.filter-btn:hover {
  border-color: var(--text-light);
  color: var(--text);
  box-shadow: var(--shadow-hover);
  transform: translateY(-1px);
}

.filter-btn.active {
  border-color: var(--filter-color, var(--accent));
  background: color-mix(in srgb, var(--filter-color, var(--accent)) 10%, transparent);
  color: var(--filter-color, var(--accent-dark));
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--filter-color, var(--accent)) 20%, transparent);
}

.filter-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.4rem;
  height: 1.4rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  background: var(--bg);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-light);
}

.filter-btn.active .filter-count {
  background: color-mix(in srgb, var(--filter-color, var(--accent)) 15%, transparent);
  color: var(--filter-color, var(--accent-dark));
}

.filter-status {
  font-size: 0.85rem;
  color: var(--text-light);
  margin-bottom: 1.25rem;
  font-weight: 500;
}

.section-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.1rem 0.6rem;
  border: 1px solid;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.6;
}

/* Animate filter transitions */
.post-card {
  transition: opacity 0.2s ease, transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

/* === Empty State === */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-light);
  font-size: 1.1rem;
}

/* === Content body (standalone pages) === */
.content-body {
  font-size: 1.05rem;
  line-height: 1.85;
  color: #2d2d3f;
  margin-top: 1rem;
}

.content-body p { margin-bottom: 1.25rem; }

/* === Back link === */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 1.5rem;
  transition: color 0.2s, gap 0.2s;
}

.back-link:hover {
  color: var(--accent);
  gap: 0.5rem;
}

/* === Responsive === */
@media (max-width: 900px) {
  .section-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  :root {
    --max-width: 100%;
  }

  .section-filter {
    gap: 0.4rem;
  }

  .filter-btn {
    padding: 0.4rem 0.85rem;
    font-size: 0.82rem;
  }

  .hero {
    padding: 2.5rem 0 2.5rem;
  }

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

  .hero p {
    font-size: 1rem;
  }

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

  .menu-toggle {
    display: block;
  }

  .nav-menu {
    display: none;
    position: absolute;
    top: var(--header-height);
    left: 0;
    right: 0;
    background: rgba(255,255,255,0.98);
    border-bottom: 1px solid var(--border);
    padding: 0.5rem 1.5rem 1rem;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
  }

  .nav-menu.open { display: block; }

  .nav-menu ul {
    flex-direction: column;
    gap: 0;
  }

  .nav-menu a {
    display: block;
    padding: 0.75rem 0;
    font-size: 1rem;
    border-bottom: 1px solid #f0f0f0;
  }

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

  .post-card {
    padding: 1.25rem;
  }

  .section-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .footer-inner {
    flex-direction: column;
    text-align: center;
    gap: 1rem;
  }

  .logo-img {
    height: 32px;
  }

  .container-wide {
    padding: 0 1rem;
  }
}
