/* Crónicas de Ayer — flexbox layout */
*, *::before, *::after { box-sizing: border-box; }

:root {
  --color-primary: #ca2f1a;
  --color-primary-dark: #a82514;
  --color-text: #333745;
  --color-muted: #666;
  --color-bg: #fff;
  --color-border: #e5e5e5;
  --color-footer-bg: #252b37;
  --max-width: 1140px;
  --font-sans: Georgia, "Times New Roman", serif;
  --font-ui: Arial, Helvetica, sans-serif;
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.6;
}

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

a { color: var(--color-primary); text-decoration: none; }
a:hover { color: var(--color-primary-dark); text-decoration: underline; }

/* Header */
.site-header {
  background: #fff;
  border-bottom: 3px solid var(--color-primary);
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
}

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

.site-logo img {
  max-height: 56px;
  width: auto;
}

/* Navigation */
.site-nav { flex: 1 1 auto; }

.nav-toggle {
  display: none;
  background: var(--color-primary);
  color: #fff;
  border: none;
  padding: .5rem .85rem;
  font-size: .9rem;
  cursor: pointer;
  border-radius: 3px;
  font-family: var(--font-ui);
}

.nav-list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0;
  list-style: none;
  margin: 0;
  padding: 0;
  font-family: var(--font-ui);
  font-size: .9rem;
  text-transform: uppercase;
  letter-spacing: .03em;
}

.nav-list > li > a {
  display: block;
  padding: .85rem 1.1rem;
  color: var(--color-text);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  transition: background .2s, color .2s;
}

.nav-list > li > a:hover,
.nav-list > li.is-active > a {
  background: var(--color-primary);
  color: #fff;
  text-decoration: none;
  border-bottom-color: var(--color-primary);
}

.nav-home a { font-size: 1.1rem; }

/* Main layout */
.site-main { padding: 1.5rem 0 2.5rem; }

.layout-container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.25rem;
}

.layout-with-sidebar {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  align-items: flex-start;
}

.layout-content { flex: 1 1 0; min-width: 0; }

.layout-sidebar {
  flex: 0 0 280px;
  max-width: 100%;
}

/* Page header */
.page-header { margin-bottom: 1.5rem; }

.page-header h1 {
  margin: 0;
  font-size: 1.75rem;
  line-height: 1.25;
  color: var(--color-text);
  border-left: 4px solid var(--color-primary);
  padding-left: .75rem;
}

.page-header .page-subtitle {
  margin: .5rem 0 0;
  color: var(--color-muted);
  font-size: .95rem;
}

/* Section titles */
.section-title {
  font-size: 1.25rem;
  margin: 0 0 1rem;
  padding-bottom: .5rem;
  border-bottom: 2px solid var(--color-primary);
  font-family: var(--font-ui);
  text-transform: uppercase;
  letter-spacing: .04em;
}

/* Hero slider */
.hero-section {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 2rem;
}

.hero-slider {
  flex: 1 1 60%;
  min-width: 280px;
  position: relative;
  overflow: hidden;
  border-radius: 4px;
  background: #111;
}

.hero-slide {
  display: none;
  position: relative;
}

.hero-slide.is-active { display: block; }

.hero-slide img { width: 100%; aspect-ratio: 660/365; object-fit: cover; }

.hero-slide-caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 1.25rem;
  background: linear-gradient(transparent, rgba(0,0,0,.85));
  color: #fff;
}

.hero-slide-caption h2 {
  margin: 0 0 .35rem;
  font-size: 1.1rem;
  line-height: 1.3;
}

.hero-slide-caption h2 a { color: #fff; }
.hero-slide-caption p { margin: 0; font-size: .85rem; opacity: .9; }

.hero-beside {
  flex: 1 1 35%;
  min-width: 240px;
  display: flex;
  flex-direction: column;
  gap: .75rem;
}

.beside-card {
  display: flex;
  gap: .75rem;
  align-items: flex-start;
  padding: .5rem;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  transition: box-shadow .2s;
}

.beside-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,.1); }

.beside-card img {
  width: 90px;
  height: 65px;
  object-fit: cover;
  flex-shrink: 0;
  border-radius: 3px;
}

.beside-card h3 {
  margin: 0;
  font-size: .85rem;
  line-height: 1.35;
  font-weight: normal;
}

.beside-card h3 a { color: var(--color-text); }

/* Featured grids */
.feature-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.feature-card {
  flex: 1 1 calc(33.333% - 1rem);
  min-width: 220px;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  overflow: hidden;
  transition: box-shadow .2s;
}

.feature-card:hover { box-shadow: 0 3px 12px rgba(0,0,0,.1); }

.feature-card img { width: 100%; aspect-ratio: 265/153; object-fit: cover; }

.feature-card-body { padding: .75rem; }

.feature-card h3 {
  margin: 0;
  font-size: .95rem;
  line-height: 1.35;
  font-weight: normal;
}

.feature-card h3 a { color: var(--color-text); }

.feature-mini-grid {
  display: flex;
  flex-direction: column;
  gap: .75rem;
}

.feature-mini {
  display: flex;
  gap: .75rem;
  align-items: center;
}

.feature-mini img {
  width: 80px;
  height: 46px;
  object-fit: cover;
  flex-shrink: 0;
  border-radius: 3px;
}

.feature-mini h3 {
  margin: 0;
  font-size: .9rem;
  font-weight: normal;
  line-height: 1.3;
}

/* Archive listing */
.archive-list { display: flex; flex-direction: column; gap: 1.5rem; }

.archive-item {
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--color-border);
}

.archive-item:last-child { border-bottom: none; }

.archive-item h2 {
  margin: 0 0 .5rem;
  font-size: 1.15rem;
  line-height: 1.3;
}

.archive-item h2 a { color: var(--color-text); }

.archive-item .excerpt { margin: 0 0 .5rem; color: var(--color-muted); font-size: .95rem; }

.read-more {
  display: inline-block;
  font-family: var(--font-ui);
  font-size: .85rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--color-primary);
  font-weight: bold;
}

/* Sidebar widgets */
.sidebar-widget {
  margin-bottom: 1.75rem;
  padding: 1rem;
  background: #f8f8f8;
  border-radius: 4px;
}

.sidebar-widget h3 {
  margin: 0 0 .75rem;
  font-size: .95rem;
  font-family: var(--font-ui);
  text-transform: uppercase;
  letter-spacing: .04em;
  border-bottom: 2px solid var(--color-primary);
  padding-bottom: .4rem;
}

.widget-list { list-style: none; margin: 0; padding: 0; }

.widget-list li {
  display: flex;
  gap: .6rem;
  margin-bottom: .75rem;
  padding-bottom: .75rem;
  border-bottom: 1px solid var(--color-border);
  font-size: .85rem;
}

.widget-list li:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }

.widget-list img { width: 70px; height: 46px; object-fit: cover; flex-shrink: 0; border-radius: 2px; }

.tag-cloud { display: flex; flex-wrap: wrap; gap: .4rem; }

.tag-cloud a {
  display: inline-block;
  padding: .25rem .6rem;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 3px;
  font-size: .8rem;
  color: var(--color-text);
}

.tag-cloud a:hover { background: var(--color-primary); color: #fff; border-color: var(--color-primary); text-decoration: none; }

/* Pagination */
.pagination {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-top: 2rem;
  font-family: var(--font-ui);
  font-size: .9rem;
}

.pagination a,
.pagination span {
  padding: .4rem .75rem;
  border: 1px solid var(--color-border);
  border-radius: 3px;
  color: var(--color-text);
}

.pagination a:hover,
.pagination .current {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
  text-decoration: none;
}

/* Blog (r-template_blog) */
.blog-container { width: 100%; }

.blog-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
}

.blog-card {
  flex: 1 1 calc(50% - 1rem);
  min-width: 260px;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  padding: 1.25rem;
  transition: box-shadow .2s;
}

.blog-card:hover { box-shadow: 0 3px 12px rgba(0,0,0,.08); }

.blog-title { margin: 0 0 .5rem; font-size: 1.05rem; }
.blog-preview p { margin: 0; color: var(--color-muted); font-size: .9rem; }

/* Article single */
.article-categories {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--color-border);
  font-size: .9rem;
  color: var(--color-muted);
  font-family: var(--font-ui);
}

/* Footer */
.site-footer {
  background: var(--color-footer-bg);
  color: #ccc;
  padding: 1.5rem 0;
  font-family: var(--font-ui);
  font-size: .9rem;
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.25rem;
  text-align: center;
}

.footer-inner a { color: #fff; }
.footer-inner .sep { margin: 0 .5rem; opacity: .5; }

/* Responsive */
@media (max-width: 768px) {
  .nav-toggle { display: block; margin-left: auto; }

  .nav-list {
    display: none;
    flex-direction: column;
    width: 100%;
    margin-top: .75rem;
  }

  .nav-list.is-open { display: flex; }

  .nav-list > li { width: 100%; }
  .nav-list > li > a { border-bottom: none; }

  .layout-sidebar { flex: 1 1 100%; }

  .feature-card { flex: 1 1 100%; }

  .hero-section { flex-direction: column; }

  .blog-card { flex: 1 1 100%; }
}
