/* ═══════════════════════════════════════════════════════
   GIRO LETRA — CSS Compartilhado
   Mobile-first. Breakpoint principal: 768px (md), 1024px (lg)
════════════════════════════════════════════════════════ */

/* ── Variáveis ────────────────────────────────────────── */
:root {
  --header-h: 56px;
  --sidebar-w: 260px;
  --accent:    #1a1a2e;
  --red:       #c0392b;
  --red-dark:  #a93226;
  --bg:        #f9f7f4;
  --card:      #ffffff;
  --muted:     #6b7280;
  --border:    #e5e0d8;
  --text:      #1a1a1a;
  --text-soft: #4b5563;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
}

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

/* ── HEADER ───────────────────────────────────────────── */
#site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: var(--accent);
  border-bottom: 3px solid var(--red);
  z-index: 200;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0 1rem;
}

.logo {
  font-family: 'Playfair Display', serif;
  font-size: 1.35rem;
  font-weight: 900;
  color: #fff;
  text-decoration: none;
  letter-spacing: -0.5px;
  white-space: nowrap;
  flex-shrink: 0;
}
.logo span { color: var(--red); }

/* nav — oculto no mobile, visível a partir de 768px */
#main-nav {
  display: none;
  gap: 0.15rem;
  align-items: center;
  flex: 1;
}
#main-nav a {
  color: #cbd5e1;
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0.35rem 0.65rem;
  border-radius: 4px;
  white-space: nowrap;
  transition: color 0.15s, background 0.15s;
}
#main-nav a:hover,
#main-nav a.active {
  color: #fff;
  background: rgba(255,255,255,0.09);
}

/* Header search */
.header-search {
  display: none; /* oculto no mobile */
  align-items: center;
  background: rgba(255,255,255,0.10);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 6px;
  overflow: hidden;
  min-width: 180px;
  flex-shrink: 0;
}
.header-search input {
  background: transparent;
  border: none;
  outline: none;
  color: #fff;
  font-size: 0.8rem;
  padding: 0.4rem 0.65rem;
  width: 100%;
  font-family: 'Inter', sans-serif;
}
.header-search input::placeholder { color: #94a3b8; }
.header-search button {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.35rem 0.55rem;
  color: #94a3b8;
  flex-shrink: 0;
}

/* Mobile: search icon only */
.header-search-icon {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.4rem;
  color: #94a3b8;
  margin-left: auto;
}

/* Sidebar toggle button (mobile) */
#sidebar-toggle {
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  padding: 0.35rem;
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

/* ── LAYOUT WRAPPER ───────────────────────────────────── */
#layout {
  display: flex;
  min-height: calc(100vh - var(--header-h));
  padding-top: var(--header-h);
}

/* ── SIDEBAR ──────────────────────────────────────────── */
#sidebar {
  position: fixed;
  top: var(--header-h);
  left: 0;
  bottom: 0;
  width: var(--sidebar-w);
  background: #fff;
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 1.25rem 1rem;
  z-index: 150;
  transform: translateX(calc(-1 * var(--sidebar-w)));
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
#sidebar.open {
  transform: translateX(0);
  box-shadow: 4px 0 24px rgba(0,0,0,0.14);
}

/* Sidebar overlay (mobile) */
#sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  z-index: 140;
}
#sidebar-overlay.show { display: block; }

/* Scrollbar fina */
#sidebar::-webkit-scrollbar { width: 3px; }
#sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* Sidebar internos */
.sidebar-section { margin-bottom: 1.75rem; }
.sidebar-title {
  font-family: 'Playfair Display', serif;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.65rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border);
}

.cat-list { list-style: none; }
.cat-list li a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-decoration: none;
  color: #374151;
  font-size: 0.85rem;
  padding: 0.35rem 0.45rem;
  border-radius: 4px;
  transition: background 0.12s, color 0.12s;
}
.cat-list li a:hover { background: var(--bg); color: var(--red); }
.cat-list .count {
  font-size: 0.68rem;
  background: #f3f4f6;
  color: var(--muted);
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
}

.recent-post {
  display: flex;
  gap: 0.6rem;
  margin-bottom: 0.85rem;
  align-items: flex-start;
}
.recent-post-thumb {
  width: 48px;
  height: 64px;
  border-radius: 3px;
  flex-shrink: 0;
  background: #e5e7eb;
}
.recent-post-meta a {
  text-decoration: none;
  color: #1a1a1a;
  font-size: 0.78rem;
  font-weight: 500;
  line-height: 1.3;
  display: block;
}
.recent-post-meta a:hover { color: var(--red); }
.recent-post-meta span {
  font-size: 0.68rem;
  color: var(--muted);
  margin-top: 0.2rem;
  display: block;
}

.tag-cloud { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.tag-cloud a {
  text-decoration: none;
  font-size: 0.68rem;
  padding: 0.2rem 0.55rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: #4b5563;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.tag-cloud a:hover { background: var(--red); color: #fff; border-color: var(--red); }

/* ── MAIN ─────────────────────────────────────────────── */
#main {
  flex: 1;
  min-width: 0;
  padding: 1.5rem 1rem 3rem;
}

/* ── BADGE ────────────────────────────────────────────── */
.badge {
  display: inline-block;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  background: var(--red);
  color: #fff;
  padding: 0.18rem 0.55rem;
  border-radius: 3px;
  width: fit-content;
}
.badge-outline {
  background: transparent;
  border: 1px solid var(--red);
  color: var(--red);
}
.badge-dark {
  background: var(--accent);
}
.badge-green {
  background: #059669;
}

/* ── STARS ────────────────────────────────────────────── */
.stars { color: #f59e0b; letter-spacing: 1px; }
.stars-sm { font-size: 0.75rem; }
.stars-lg { font-size: 1.1rem; }

/* ── BUTTONS ──────────────────────────────────────────── */
.btn {
  display: inline-block;
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.6rem 1.25rem;
  border-radius: 5px;
  border: none;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  font-family: 'Inter', sans-serif;
  line-height: 1;
}
.btn-red { background: var(--red); color: #fff; }
.btn-red:hover { background: var(--red-dark); }
.btn-outline { background: transparent; color: var(--red); border: 2px solid var(--red); }
.btn-outline:hover { background: var(--red); color: #fff; }
.btn-dark { background: var(--accent); color: #fff; }
.btn-dark:hover { background: #12122a; }
.btn-sm { font-size: 0.78rem; padding: 0.45rem 0.9rem; }

/* ── SECTION HEADER ───────────────────────────────────── */
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.1rem;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.section-head h2 {
  font-family: 'Playfair Display', serif;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--accent);
  position: relative;
  padding-left: 0.85rem;
}
.section-head h2::before {
  content: '';
  position: absolute;
  left: 0; top: 4px; bottom: 4px;
  width: 3px;
  background: var(--red);
  border-radius: 2px;
}
.section-head a {
  font-size: 0.8rem;
  color: var(--red);
  text-decoration: none;
  font-weight: 500;
  white-space: nowrap;
}
.section-head a:hover { text-decoration: underline; }

/* ── PAGE TITLE ───────────────────────────────────────── */
.page-title-bar {
  background: var(--accent);
  color: #fff;
  padding: 2rem 1rem;
  margin: -1.5rem -1rem 2rem;
}
.page-title-bar h1 {
  font-family: 'Playfair Display', serif;
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 0.3rem;
}
.page-title-bar p { color: #94a3b8; font-size: 0.875rem; }

/* ── FILTER BAR ───────────────────────────────────────── */
.filter-bar {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}
.filter-btn {
  background: #fff;
  border: 1px solid var(--border);
  color: #374151;
  font-size: 0.8rem;
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.filter-btn:hover,
.filter-btn.active {
  background: var(--red);
  color: #fff;
  border-color: var(--red);
}

/* ── CARDS ────────────────────────────────────────────── */
.card-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.1rem;
  margin-bottom: 2rem;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  transition: box-shadow 0.2s, transform 0.2s;
}
.card:hover {
  box-shadow: 0 6px 20px rgba(0,0,0,0.09);
  transform: translateY(-2px);
}

.card-cover {
  width: 100%;
  height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}
.card-cover-book {
  width: 76px;
  height: 104px;
  background: linear-gradient(145deg, #374151, #1f2937);
  border-radius: 2px;
  box-shadow: 3px 3px 10px rgba(0,0,0,0.3);
}
.card-cover-badge {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
}

.card-body { padding: 1rem; }
.card-category {
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--red);
  margin-bottom: 0.3rem;
}
.card-title {
  font-family: 'Playfair Display', serif;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
  margin-bottom: 0.25rem;
}
.card-title a { text-decoration: none; color: inherit; }
.card-title a:hover { color: var(--red); }
.card-author { font-size: 0.75rem; color: var(--muted); margin-bottom: 0.45rem; }
.card-excerpt {
  font-size: 0.78rem;
  color: var(--text-soft);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 0.75rem;
}
.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--border);
  padding-top: 0.55rem;
  margin-top: 0.4rem;
}
.card-date { font-size: 0.7rem; color: var(--muted); }

/* ── LIST CARD ────────────────────────────────────────── */
.list-card {
  display: flex;
  gap: 1rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 0.85rem;
  align-items: flex-start;
  transition: box-shadow 0.2s;
}
.list-card:hover { box-shadow: 0 4px 14px rgba(0,0,0,0.07); }
.list-card-cover {
  width: 60px;
  height: 84px;
  border-radius: 3px;
  flex-shrink: 0;
  box-shadow: 2px 2px 8px rgba(0,0,0,0.2);
}
.list-card-body { flex: 1; min-width: 0; }
.list-card-title {
  font-family: 'Playfair Display', serif;
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 0.2rem;
}
.list-card-title a { text-decoration: none; color: var(--text); }
.list-card-title a:hover { color: var(--red); }
.list-card-meta { font-size: 0.72rem; color: var(--muted); margin-bottom: 0.35rem; }
.list-card-excerpt {
  font-size: 0.8rem;
  color: var(--text-soft);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── NEWSLETTER ───────────────────────────────────────── */
.newsletter-box {
  background: var(--accent);
  border-radius: 10px;
  padding: 1.75rem 1.25rem;
  text-align: center;
  color: #fff;
  margin-bottom: 2rem;
}
.newsletter-box h3 {
  font-family: 'Playfair Display', serif;
  font-size: 1.3rem;
  margin-bottom: 0.4rem;
}
.newsletter-box p { font-size: 0.85rem; color: #94a3b8; margin-bottom: 1.1rem; }
.newsletter-form {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: 440px;
  margin: 0 auto;
}
.newsletter-form input {
  flex: 1;
  padding: 0.6rem 1rem;
  border-radius: 5px;
  border: none;
  outline: none;
  font-size: 0.875rem;
  font-family: 'Inter', sans-serif;
}
.newsletter-form button {
  background: var(--red);
  color: #fff;
  border: none;
  padding: 0.65rem 1.25rem;
  border-radius: 5px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
}
.newsletter-form button:hover { background: var(--red-dark); }

/* ── PAGINATION ───────────────────────────────────────── */
.pagination {
  display: flex;
  justify-content: center;
  gap: 0.35rem;
  flex-wrap: wrap;
  margin: 2rem 0 1rem;
}
.page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 0.6rem;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 5px;
  font-size: 0.82rem;
  color: #374151;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
  font-family: 'Inter', sans-serif;
}
.page-btn:hover, .page-btn.active {
  background: var(--red);
  color: #fff;
  border-color: var(--red);
}

/* ── BREADCRUMB ───────────────────────────────────────── */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}
.breadcrumb a { text-decoration: none; color: var(--muted); }
.breadcrumb a:hover { color: var(--red); }
.breadcrumb span { color: #d1d5db; }

/* ── FOOTER ───────────────────────────────────────────── */
footer {
  background: var(--accent);
  color: #94a3b8;
  font-size: 0.78rem;
  text-align: center;
  padding: 1.25rem 1rem;
}
footer a { color: #cbd5e1; text-decoration: none; }
footer a:hover { color: #fff; }

/* ══════════════════════════════════════════════════════════
   MEDIA QUERIES — mobile-first breakpoints
══════════════════════════════════════════════════════════ */

/* 480px — pequenos smartphones */
@media (min-width: 480px) {
  .card-grid { grid-template-columns: repeat(2, 1fr); }
  .newsletter-form { flex-direction: row; }
}

/* 768px — tablets / landscape phone */
@media (min-width: 768px) {
  :root { --header-h: 60px; }

  #site-header { padding: 0 1.5rem; gap: 1rem; }

  #main-nav { display: flex; }

  .header-search { display: flex; }
  .header-search-icon { display: none; }

  #sidebar-toggle { display: none; }

  #sidebar {
    transform: translateX(0);
    box-shadow: none;
  }

  #sidebar-overlay { display: none !important; }

  #layout { padding-top: var(--header-h); }

  #main {
    margin-left: var(--sidebar-w);
    padding: 2rem 2rem 3rem;
  }

  footer { margin-left: var(--sidebar-w); }

  .page-title-bar {
    padding: 2.5rem 2rem;
    margin: -2rem -2rem 2rem;
  }
  .page-title-bar h1 { font-size: 2rem; }

  .card-grid { grid-template-columns: repeat(2, 1fr); }
}

/* 1024px — desktop */
@media (min-width: 1024px) {
  :root { --header-h: 64px; --sidebar-w: 280px; }

  #site-header { padding: 0 1.75rem; gap: 1.5rem; }

  #main-nav a { font-size: 0.9rem; padding: 0.4rem 0.8rem; }

  .header-search { min-width: 220px; }

  .card-grid { grid-template-columns: repeat(3, 1fr); }

  .section-head h2 { font-size: 1.35rem; }

  .page-title-bar h1 { font-size: 2.25rem; }
}
