/*
Theme Name: smartGSM Astro
Theme URI: https://www.smart-gsm.com
Description: Tema que replica el diseño del sitio Astro de smartGSM. Mismo header, footer, tipografía y colores.
Version: 1.2.0
Author: smartGSM
Author URI: https://www.smart-gsm.com
Text Domain: smartgsmastro
*/

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

:root {
  --red: #e8000d;
  --red-dark: #c5000b;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --max-width: 72rem;
}

html { font-size: 16px; }

body {
  font-family: var(--font);
  font-size: 0.875rem;
  color: var(--gray-800);
  background: var(--gray-50);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: inherit; text-decoration: none; }
a:hover { color: var(--red); }
img { max-width: 100%; height: auto; display: block; }
ul, ol { list-style: none; }

/* ===== HEADER ===== */
.site-header {
  background: white;
  border-bottom: 1px solid var(--gray-200);
  position: sticky;
  top: 0;
  z-index: 50;
}

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

.site-logo img { height: 36px; width: auto; display: block; }

.site-nav { display: flex; align-items: center; gap: 1.5rem; }

.site-nav a {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--gray-700);
  transition: color 0.15s;
}
.site-nav a:hover,
.site-nav a.current { color: var(--red); }

.header-search {
  display: flex;
  align-items: center;
}

.header-search input {
  border: 1px solid var(--gray-300);
  border-radius: 0.375rem 0 0 0.375rem;
  padding: 0.375rem 0.75rem;
  font-size: 0.875rem;
  width: 12rem;
  outline: none;
  font-family: var(--font);
  color: var(--gray-800);
}
.header-search input:focus { border-color: var(--red); }

.header-search button {
  background: var(--red);
  color: white;
  border: none;
  padding: 0.375rem 0.75rem;
  border-radius: 0 0.375rem 0.375rem 0;
  font-size: 0.875rem;
  cursor: pointer;
  font-family: var(--font);
  transition: background 0.15s;
}
.header-search button:hover { background: var(--red-dark); }

/* Mobile menu toggle */
.menu-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  color: var(--gray-700);
}

/* ===== MAIN ===== */
.site-main {
  flex: 1;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1.5rem 1rem;
  width: 100%;
}

/* ===== BREADCRUMB ===== */
.breadcrumb {
  font-size: 0.75rem;
  color: var(--gray-500);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-wrap: wrap;
}
.breadcrumb a { color: var(--red); }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb span { color: var(--gray-400); }

/* ===== LAYOUT ===== */
.content-sidebar {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
}

@media (min-width: 1024px) {
  .content-sidebar {
    grid-template-columns: 1fr 300px;
  }
}

/* ===== SINGLE POST ===== */
.post-header { margin-bottom: 1.5rem; }

.post-cats {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.post-cat {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--red);
  color: white;
  padding: 0.2rem 0.6rem;
  border-radius: 9999px;
}

.post-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--gray-900);
  line-height: 1.3;
  margin-bottom: 0.75rem;
}

.post-meta {
  font-size: 0.75rem;
  color: var(--gray-500);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.post-meta a { color: var(--gray-500); }
.post-meta a:hover { color: var(--red); }

.post-featured-image {
  margin-bottom: 1.5rem;
  border-radius: 0.5rem;
  overflow: hidden;
}

.post-featured-image img {
  width: 100%;
  height: auto;
  display: block;
}

/* En resumen / excerpt box */
.post-summary {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-left: 3px solid var(--red);
  border-radius: 0.5rem;
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
}

.post-summary h4 {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--red);
  margin-bottom: 0.5rem;
}

.post-summary p {
  font-size: 0.875rem;
  color: var(--gray-700);
  line-height: 1.6;
  margin: 0;
}

/* Post content */
.post-content {
  color: var(--gray-800);
  line-height: 1.75;
  font-size: 0.9375rem;
}

.post-content h2 { font-size: 1.375rem; font-weight: 700; margin: 1.75rem 0 0.75rem; color: var(--gray-900); }
.post-content h3 { font-size: 1.125rem; font-weight: 600; margin: 1.5rem 0 0.5rem; color: var(--gray-900); }
.post-content p { margin-bottom: 1rem; }
.post-content a { color: var(--red); text-decoration: underline; }
.post-content ul, .post-content ol { margin: 0 0 1rem 1.5rem; list-style: disc; }
.post-content ol { list-style: decimal; }
.post-content li { margin-bottom: 0.25rem; }
.post-content img { border-radius: 0.5rem; margin: 1rem auto; }
.post-content blockquote {
  border-left: 3px solid var(--red);
  padding: 0.75rem 1rem;
  margin: 1rem 0;
  background: var(--gray-50);
  color: var(--gray-700);
  font-style: italic;
}
.post-content figure { margin: 1rem 0; }
.post-content figcaption { font-size: 0.75rem; color: var(--gray-500); text-align: center; margin-top: 0.25rem; }

/* ===== PHONE CARD ===== */
.phone-card {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: 0.75rem;
  padding: 1rem;
  margin: 1.5rem 0;
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.phone-card:hover {
  border-color: var(--gray-300);
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.phone-card-image {
  flex-shrink: 0;
}

.phone-card-image img {
  width: 80px;
  height: 106px;
  object-fit: contain;
  border-radius: 0.375rem;
}

.phone-card-body { flex: 1; min-width: 0; }

.phone-card-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 0.5rem;
}

.phone-card-title a { color: var(--gray-900); }
.phone-card-title a:hover { color: var(--red); }

.phone-card-desc {
  font-size: 0.8125rem;
  color: var(--gray-600);
  line-height: 1.5;
  margin-bottom: 0.75rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.phone-card-stats {
  display: flex;
  gap: 1rem;
  font-size: 0.75rem;
  color: var(--gray-500);
}

.phone-card-stats span strong {
  color: var(--gray-700);
}

.phone-card-cta {
  display: inline-block;
  margin-top: 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--red);
  border: 1px solid var(--red);
  border-radius: 0.375rem;
  padding: 0.25rem 0.75rem;
  transition: background 0.15s, color 0.15s;
}
.phone-card-cta:hover {
  background: var(--red);
  color: white;
}

/* ===== AUTHOR BOX ===== */
.author-box {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: 0.75rem;
  padding: 1.25rem;
  margin-top: 2rem;
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.author-avatar img {
  width: 56px;
  height: 56px;
  border-radius: 9999px;
  object-fit: cover;
  flex-shrink: 0;
}

.author-avatar-placeholder {
  width: 56px;
  height: 56px;
  border-radius: 9999px;
  background: var(--red);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.25rem;
  flex-shrink: 0;
}

.author-info h4 {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 0.25rem;
}

.author-info p {
  font-size: 0.8125rem;
  color: var(--gray-600);
  line-height: 1.5;
  margin: 0;
}

/* ===== RELATED POSTS ===== */
.related-posts { margin-top: 2rem; }

.related-posts h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--gray-800);
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--gray-200);
}

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

.related-card {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: 0.5rem;
  overflow: hidden;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.related-card:hover {
  border-color: var(--gray-300);
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.related-card img {
  width: 100%;
  height: 120px;
  object-fit: cover;
}

.related-card-body { padding: 0.75rem; }

.related-card-body h4 {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--gray-800);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.related-card:hover h4 { color: var(--red); }

.related-card-date { font-size: 0.7rem; color: var(--gray-400); margin-top: 0.25rem; }

/* ===== ARCHIVE / BLOG INDEX ===== */
.archive-header { margin-bottom: 1.5rem; }

.archive-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 0.25rem;
}

.archive-description {
  font-size: 0.875rem;
  color: var(--gray-500);
}

.posts-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

@media (min-width: 640px) {
  .posts-grid { grid-template-columns: 1fr 1fr; }
}

@media (min-width: 1024px) {
  .posts-grid { grid-template-columns: 1fr 1fr 1fr; }
}

.post-card {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: 0.5rem;
  overflow: hidden;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.post-card:hover {
  border-color: var(--gray-300);
  box-shadow: 0 2px 8px rgba(0,0,0,0.07);
}

.post-card-img {
  width: 100%;
  height: 180px;
  object-fit: cover;
}

.post-card-img-placeholder {
  width: 100%;
  height: 180px;
  background: var(--gray-100);
}

.post-card-body { padding: 1rem; }

.post-card-cat {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--red);
  margin-bottom: 0.375rem;
}

.post-card-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--gray-800);
  line-height: 1.4;
  margin-bottom: 0.5rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.post-card:hover .post-card-title { color: var(--red); }

.post-card-excerpt {
  font-size: 0.8125rem;
  color: var(--gray-500);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 0.75rem;
}

.post-card-meta { font-size: 0.7rem; color: var(--gray-400); }

/* ===== SIDEBAR ===== */
.sidebar { display: flex; flex-direction: column; gap: 1.5rem; }

.widget {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: 0.5rem;
  padding: 1rem;
}

.widget-title {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--gray-800);
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--gray-100);
}

/* Recent posts widget */
.widget-recent li {
  display: flex;
  gap: 0.75rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--gray-50);
}
.widget-recent li:last-child { border-bottom: none; }
.widget-recent img { width: 56px; height: 40px; object-fit: cover; border-radius: 0.25rem; flex-shrink: 0; }
.widget-recent a { font-size: 0.75rem; font-weight: 500; color: var(--gray-700); line-height: 1.4; }
.widget-recent a:hover { color: var(--red); }

/* Category list */
.widget-cats li { padding: 0.375rem 0; border-bottom: 1px solid var(--gray-50); }
.widget-cats li:last-child { border-bottom: none; }
.widget-cats a { font-size: 0.8125rem; color: var(--gray-600); display: flex; justify-content: space-between; }
.widget-cats a:hover { color: var(--red); }
.widget-cats .count { color: var(--gray-400); font-size: 0.75rem; }

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

.pagination a,
.pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  height: 2rem;
  padding: 0 0.625rem;
  border: 1px solid var(--gray-300);
  border-radius: 0.375rem;
  color: var(--gray-700);
  transition: border-color 0.15s, color 0.15s;
}

.pagination a:hover { border-color: var(--red); color: var(--red); }
.pagination .current { background: var(--red); border-color: var(--red); color: white; }
.pagination .dots { border: none; color: var(--gray-400); }

/* ===== FOOTER ===== */
.site-footer {
  background: white;
  border-top: 1px solid var(--gray-200);
  margin-top: auto;
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem 1rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

@media (min-width: 768px) {
  .footer-grid { grid-template-columns: repeat(4, 1fr); }
}

.footer-col h4 {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--gray-800);
  margin-bottom: 0.75rem;
}

.footer-col p {
  font-size: 0.75rem;
  color: var(--gray-500);
  line-height: 1.6;
}

.footer-col ul li { margin-bottom: 0.375rem; }
.footer-col ul a { font-size: 0.8125rem; color: var(--gray-500); }
.footer-col ul a:hover { color: var(--red); }

.footer-bottom {
  border-top: 1px solid var(--gray-100);
  padding-top: 1rem;
  text-align: center;
  font-size: 0.75rem;
  color: var(--gray-400);
}

/* ===== MOBILE ===== */
@media (max-width: 767px) {
  .site-nav,
  .header-search { display: none; }
  .menu-toggle { display: block; }
  .mobile-menu {
    background: white;
    border-top: 1px solid var(--gray-100);
    padding: 0.75rem 1rem;
  }
  .mobile-menu.hidden { display: none; }
  .mobile-menu a {
    display: block;
    padding: 0.625rem 0;
    font-size: 0.875rem;
    color: var(--gray-700);
    border-bottom: 1px solid var(--gray-50);
  }
  .mobile-menu a:last-child { border-bottom: none; }
  .mobile-menu a:hover { color: var(--red); }
  .mobile-search {
    display: flex;
    margin-bottom: 0.75rem;
  }
  .mobile-search input {
    flex: 1;
    border: 1px solid var(--gray-300);
    border-radius: 0.375rem 0 0 0.375rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    outline: none;
    font-family: var(--font);
  }
  .mobile-search button {
    background: var(--red);
    color: white;
    border: none;
    padding: 0.5rem 0.75rem;
    border-radius: 0 0.375rem 0.375rem 0;
    font-size: 0.875rem;
    cursor: pointer;
  }
  .related-grid { grid-template-columns: 1fr; }
  .post-title { font-size: 1.375rem; }
}

/* ===== ADMIN BAR ===== */
#wpadminbar { display: none !important; }
html { margin-top: 0 !important; }

/* ===== GUTENBERG GALLERY =====
   Override theme figure/img resets that fight WP block styles */
.post-content .wp-block-gallery {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 0.5em !important;
    margin: 1.5rem 0 !important;
}
.post-content .wp-block-gallery figure.wp-block-image {
    flex: 1 1 calc(50% - 0.5em) !important;
    margin: 0 !important;
    width: auto !important;
}
.post-content .wp-block-gallery figure.wp-block-image img {
    width: 100% !important;
    height: auto !important;
    margin: 0 !important;
    border-radius: 4px;
    object-fit: cover;
}

/* ===== MOBILE MENU: hidden by default, JS toggles .hidden =====  */
.mobile-menu { display: none; }
.mobile-menu:not(.hidden) { display: block; }

/* ===== HEADER SOCIAL ICONS ===== */
.header-social {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.header-social a {
    color: var(--gray-400);
    transition: color 0.15s;
    display: flex;
    align-items: center;
}
.header-social a:hover { color: var(--red); }

/* ===== SOCIAL SHARE ===== */
.post-share {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
}
.post-share-label {
    font-size: 0.75rem;
    color: var(--gray-400);
}
.post-share-btn {
    color: var(--gray-400);
    display: flex;
    align-items: center;
    transition: color 0.15s;
}
.post-share-btn:hover { color: var(--red); }
.post-share-wa:hover { color: #25d366; }

/* ===== PHONE MINI LIST (sidebar) ===== */
.phone-mini-list {
    list-style: none;
    margin: 0.5rem 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.phone-mini-item a {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--gray-700);
    font-size: 0.8125rem;
    text-decoration: none;
    padding: 0.25rem 0;
}
.phone-mini-item a:hover { color: var(--red); }
.phone-mini-item img {
    width: 40px;
    height: 53px;
    object-fit: contain;
    border-radius: 3px;
    flex-shrink: 0;
}
.widget-more {
    display: block;
    font-size: 0.75rem;
    color: var(--red);
    text-decoration: none;
    margin-bottom: 0.25rem;
}
.widget-more:hover { text-decoration: underline; }

/* ===== AD UNIT ===== */
.ad-unit {
    text-align: center;
    overflow: hidden;
}

/* ===== STICKY SIDEBAR AD ===== */
#ad-sidebar-top {
    position: sticky;
    top: 4.5rem;
}

/* ===== FOOTER SOCIAL ICONS ===== */
.footer-social {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.75rem;
}
.footer-social a {
    color: var(--gray-400);
    display: flex;
    align-items: center;
    transition: color 0.15s;
}
.footer-social a:hover { color: var(--red); }
