/*
Theme Name: MeuDireito
Theme URI: https://meudireito.com/
Author: MeuDireito
Description: Tema editorial responsivo para artigos juridicos do MeuDireito.
Version: 1.0.1
Text Domain: meudireito
*/

/* ============================================
   CSS Custom Properties (Design Tokens)
   ============================================ */
:root {
  /* Colors */
  --md-text: #1f2937;
  --md-muted: #6b7280;
  --md-border: #e5e7eb;
  --md-bg: #fff;
  --md-soft: #f8fafc;
  --md-link: #0f4c81;

  /* Layout */
  --md-max: 720px;
  --md-site-max: 1120px;

  /* Spacing */
  --md-space-xs: 0.4rem;
  --md-space-sm: 0.75rem;
  --md-space-md: 1.25rem;
  --md-space-lg: 2rem;
  --md-space-xl: 3rem;
}

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

html {
  font-size: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--md-bg);
  color: var(--md-text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: clamp(1rem, 2vw, 1.125rem);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--md-link);
  text-underline-offset: 0.15em;
}

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

/* ============================================
   Site Header
   ============================================ */
.site-header {
  border-bottom: 1px solid var(--md-border);
  background: #fff;
}

.site-header__inner {
  max-width: var(--md-site-max);
  margin: 0 auto;
  padding: var(--md-space-sm) var(--md-space-md);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.site-branding {
  display: flex;
  align-items: center;
  gap: var(--md-space-sm);
}

.site-title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
}

.site-title a {
  text-decoration: none;
  color: var(--md-text);
}

.site-description {
  margin: 0.15rem 0 0;
  color: var(--md-muted);
  font-size: 0.9rem;
}

.custom-logo {
  max-height: 52px;
  width: auto;
}

/* ============================================
   Main Navigation
   ============================================ */
.main-navigation {
  margin-top: 0;
}

.main-nav-menu {
  display: flex;
  flex-wrap: wrap;
  gap: var(--md-space-xs) 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.main-nav-menu a {
  text-decoration: none;
  font-weight: 600;
  color: var(--md-text);
  transition: color 0.15s;
}

.main-nav-menu a:hover {
  color: var(--md-link);
}

/* ============================================
   Site Main / Article Container
   ============================================ */
.site-main {
  padding: var(--md-space-lg) var(--md-space-md) var(--md-space-xl);
}

.article {
  max-width: var(--md-max);
  margin: 0 auto;
}

/* ============================================
   Article Header
   ============================================ */
.entry-header {
  margin-bottom: 1.5rem;
}

/* H1: Large, bold, clear article title per spec */
.entry-title {
  margin: 0 0 0.75rem;
  font-size: clamp(2rem, 6vw, 3.35rem);
  font-weight: 800;
  line-height: 1.12;
  letter-spacing: -0.025em;
  color: var(--md-text);
}

/* ============================================
   Entry Meta: date, categories
   ============================================ */
.entry-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  color: var(--md-muted);
  font-size: 0.95rem;
}

/* Category pill badges */
.post-categories {
  display: flex;
  flex-wrap: wrap;
  gap: var(--md-space-xs);
}

.post-categories a {
  padding: 0.15rem 0.55rem;
  border: 1px solid var(--md-border);
  border-radius: 999px;
  text-decoration: none;
  font-size: 0.85rem;
  color: var(--md-link);
  background: var(--md-soft);
  transition: background 0.15s, border-color 0.15s;
}

.post-categories a:hover {
  background: var(--md-bg);
  border-color: var(--md-link);
}

/* ============================================
   Featured Image: responsive hero
   ============================================ */
.featured-image {
  margin: 0 0 2rem;
}

.featured-image img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 14px;
  object-fit: cover;
}

/* ============================================
   Article Content Typography
   ============================================ */
.entry-content {
  font-size: clamp(1.05rem, 2vw, 1.18rem);
  line-height: 1.7;
}

/* H2: Section heading, proper hierarchy */
.entry-content h2 {
  margin: 2.25rem 0 0.75rem;
  font-size: clamp(1.55rem, 4vw, 2.1rem);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.015em;
  color: var(--md-text);
  scroll-margin-top: 1rem;
}

/* H3: Subsection heading */
.entry-content h3 {
  margin: 1.75rem 0 0.6rem;
  font-size: clamp(1.3rem, 3vw, 1.65rem);
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.015em;
  color: var(--md-text);
  scroll-margin-top: 1rem;
}

.entry-content p,
.entry-content ul,
.entry-content ol {
  margin: 0 0 1.2rem;
}

.entry-content ul,
.entry-content ol {
  padding-left: 1.5rem;
}

.entry-content li {
  margin-bottom: 0.4rem;
}

/* Blockquote */
.entry-content blockquote {
  margin: 1.5rem 0;
  padding: 1rem 1.25rem;
  border-left: 4px solid var(--md-link);
  background: var(--md-soft);
  border-radius: 0 6px 6px 0;
  font-style: italic;
}

.entry-content blockquote p:last-child {
  margin-bottom: 0;
}

/* Tables */
.entry-content table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  margin-bottom: 1.2rem;
}

.entry-content th,
.entry-content td {
  padding: 0.65rem;
  border: 1px solid var(--md-border);
  text-align: left;
}

.entry-content th {
  background: var(--md-soft);
  font-weight: 600;
}

/* Code */
.entry-content code {
  background: var(--md-soft);
  padding: 0.1em 0.4em;
  border-radius: 4px;
  font-size: 0.9em;
}

.entry-content pre {
  background: var(--md-soft);
  padding: 1rem;
  border-radius: 6px;
  overflow-x: auto;
  margin-bottom: 1.2rem;
}

.entry-content pre code {
  background: none;
  padding: 0;
}

/* ============================================
   Entry Excerpt
   ============================================ */
.entry-excerpt {
  margin-top: 1.5rem;
  font-size: clamp(0.95rem, 2vw, 1.1rem);
  color: var(--md-muted);
}

/* ============================================
   Site Footer
   ============================================ */
.site-footer {
  border-top: 1px solid var(--md-border);
  background: var(--md-soft);
  color: var(--md-muted);
  font-size: 0.9rem;
}

.site-footer__inner {
  max-width: var(--md-site-max);
  margin: 0 auto;
  padding: var(--md-space-md);
}

.footer-widget-area {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--md-space-md);
  margin-bottom: var(--md-space-md);
}

.footer-widget-area .widget {
  padding: var(--md-space-sm);
}

.footer-widget-area .widget-title {
  font-size: 1rem;
  font-weight: 700;
  margin: 0 0 var(--md-space-xs);
  color: var(--md-text);
}

.footer-widget-area ul {
  margin: 0;
  padding-left: 1.25rem;
}

.footer-widget-area li {
  margin-bottom: 0.4rem;
}

.site-footer p {
  margin: 0;
}

/* ============================================
   Accessibility & Utilities
   ============================================ */
.screen-reader-text {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--md-link);
  outline-offset: 2px;
  border-radius: 2px;
}

/* ============================================
   Responsive Breakpoints
   ============================================ */

/* Mobile-first: narrow viewport defaults are set above via clamp() and
   flex-wrap. These max-width rules tighten layout on small screens. */

/* Small phone: 360px-480px */
@media (max-width: 479px) {
  .site-main {
    padding: var(--md-space-md) var(--md-space-sm) var(--md-space-lg);
  }

  .article {
    width: 100%;
    max-width: 100%;
  }

  .entry-title {
    font-size: clamp(1.6rem, 9vw, 2.4rem);
  }

  .entry-content h2 {
    font-size: clamp(1.35rem, 6vw, 1.75rem);
  }

  .entry-content h3 {
    font-size: clamp(1.15rem, 4.5vw, 1.4rem);
  }

  .featured-image {
    margin: 0 0 var(--md-space-md);
    border-radius: 8px;
  }

  .site-footer__inner {
    padding: var(--md-space-sm);
  }
}

/* Tablet: 768px+ */
@media (min-width: 768px) {
  .site-header__inner {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding-left: 2rem;
    padding-right: 2rem;
  }

  .site-main {
    padding-top: var(--md-space-xl);
    padding-left: 2rem;
    padding-right: 2rem;
  }

  .site-footer__inner {
    padding-left: 2rem;
    padding-right: 2rem;
  }
}

/* Desktop: 1024px+ */
@media (min-width: 1024px) {
  .site-header__inner,
  .site-footer__inner {
    padding-left: 0;
    padding-right: 0;
  }
}