/*
Theme Name: Defensa360
Theme URI: https://defensa360.com
Author: Defensa360
Description: Theme editorial a medida para Defensa360 (noticias de defensa y tecnología militar). Sin dependencia de Elementor ni de ningún page builder.
Version: 1.0.0
Requires at least: 6.0
Requires PHP: 7.4
Text Domain: defensa360
*/

/* ---------------------------------------------------------------------
   Variables / paleta
--------------------------------------------------------------------- */
:root {
  --d360-bg: #ffffff;
  --d360-text: #1a1d21;
  --d360-text-muted: #5b6470;
  --d360-header-bg: #0f1720;
  --d360-header-text: #e8eaed;
  --d360-accent: #3a6ea5;
  --d360-accent-dark: #274c73;
  --d360-border: #e3e6ea;
  --d360-card-bg: #f7f8fa;
  --d360-max-width: 1180px;
}

/* Colores por categoría (badges) — coinciden con las categorías reales de WordPress */
.cat-armada { --cat-color: #1f4e79; }
.cat-conflictos { --cat-color: #8a1f1f; }
.cat-drones { --cat-color: #4a5568; }
.cat-ejercito-de-tierra { --cat-color: #4a5c2f; }
.cat-ejercito-aire { --cat-color: #2b6cb0; }
.cat-guerra-rusia-ucrania { --cat-color: #7a2e2e; }
.cat-sistemas-defensa { --cat-color: #3a6ea5; }

/* ---------------------------------------------------------------------
   Reset / base
--------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--d360-bg);
  color: var(--d360-text);
  font-family: 'Source Sans 3', 'Segoe UI', Arial, sans-serif;
  font-size: 17px;
  line-height: 1.6;
}
h1, h2, h3, h4, h5 {
  font-family: 'Oswald', 'Arial Narrow', Arial, sans-serif;
  font-weight: 600;
  line-height: 1.25;
  margin: 0 0 .5em;
  letter-spacing: .01em;
}
a { color: var(--d360-accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; display: block; }
ul { list-style: none; margin: 0; padding: 0; }
.container {
  max-width: var(--d360-max-width);
  margin: 0 auto;
  padding: 0 20px;
}
.screen-reader-text {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(1px,1px,1px,1px); white-space: nowrap;
}

/* ---------------------------------------------------------------------
   Header
--------------------------------------------------------------------- */
.site-header {
  background: var(--d360-header-bg);
  color: var(--d360-header-text);
  border-bottom: 3px solid var(--d360-accent);
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  padding-top: 14px;
  padding-bottom: 14px;
  gap: 12px;
}
.site-branding { display: flex; align-items: center; gap: 12px; }
.site-branding img { max-height: 46px; width: auto; }
.site-title {
  font-family: 'Oswald', Arial, sans-serif;
  font-size: 1.5rem;
  color: var(--d360-header-text);
  margin: 0;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.site-title a { color: inherit; }
.site-title a:hover { text-decoration: none; opacity: .85; }
.site-description {
  font-size: .8rem;
  color: #9aa4b1;
  margin: 2px 0 0;
}

.primary-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.primary-nav a {
  display: block;
  padding: 8px 12px;
  color: var(--d360-header-text);
  font-size: .92rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .03em;
  border-radius: 3px;
}
.primary-nav a:hover,
.primary-nav .current-menu-item > a {
  background: rgba(255,255,255,.08);
  text-decoration: none;
  color: #fff;
}

/* ---------------------------------------------------------------------
   Category badge
--------------------------------------------------------------------- */
.cat-badge {
  display: inline-block;
  background: var(--cat-color, var(--d360-accent));
  color: #fff;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: 3px 10px;
  border-radius: 3px;
}
.cat-badge:hover { color: #fff; text-decoration: none; opacity: .9; }

.entry-meta {
  color: var(--d360-text-muted);
  font-size: .85rem;
  margin: 6px 0 0;
}
.entry-meta a { color: inherit; }

/* ---------------------------------------------------------------------
   Home / front page
--------------------------------------------------------------------- */
.home-content { padding: 32px 0 48px; }

.featured-story {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 28px;
  margin-bottom: 40px;
  padding-bottom: 40px;
  border-bottom: 1px solid var(--d360-border);
}
.featured-story .thumb { border-radius: 4px; overflow: hidden; aspect-ratio: 16/10; background: var(--d360-card-bg); }
.featured-story .thumb img { width: 100%; height: 100%; object-fit: cover; }
.featured-story h1, .featured-story h2 { font-size: 2rem; margin: 12px 0 10px; }
.featured-story .excerpt { color: var(--d360-text-muted); font-size: 1.05rem; }

.section-heading {
  font-size: 1.1rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--d360-text);
  border-left: 4px solid var(--d360-accent);
  padding-left: 10px;
  margin: 40px 0 18px;
}

.post-grid {
  display: grid;
  /* auto-fit (no auto-fill): si una sección tiene pocos artículos, se
     reparten el ancho disponible en vez de dejar columnas fantasma en
     blanco al lado. */
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 24px;
}
.post-card {
  background: var(--d360-card-bg);
  border: 1px solid var(--d360-border);
  border-radius: 5px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.post-card .thumb { aspect-ratio: 16/9; background: #e9ebee; }
.post-card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.post-card .body { padding: 14px 16px 18px; flex: 1; display: flex; flex-direction: column; }
.post-card h3 { font-size: 1.05rem; margin: 8px 0 6px; }
.post-card h3 a { color: var(--d360-text); }
.post-card .excerpt { font-size: .92rem; color: var(--d360-text-muted); flex: 1; }
.post-card {
  box-shadow: 0 1px 3px rgba(15,23,32,.06);
  transition: transform .15s ease, box-shadow .15s ease;
}
.post-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(15,23,32,.12);
}

/* Panel neutro cuando el post todavía no tiene imagen de portada real */
.thumb-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--cat-color, var(--d360-accent)) 0%, rgba(15,23,32,.85) 100%);
}
.thumb-placeholder-icon { color: rgba(255,255,255,.85); }

/* ---------------------------------------------------------------------
   Single post
--------------------------------------------------------------------- */
.single-article { padding: 36px 0 56px; max-width: 800px; margin: 0 auto; }
.single-article .entry-header { margin-bottom: 20px; }
.single-article .entry-title { font-size: 2.1rem; margin: 10px 0; }
.single-article .entry-thumb { margin: 20px 0; border-radius: 5px; overflow: hidden; }
.single-article .entry-content { font-size: 1.08rem; }
.single-article .entry-content p { margin: 0 0 1.2em; }
.single-article .entry-content h2 { font-size: 1.5rem; margin-top: 1.6em; }
.single-article .entry-content h3 { font-size: 1.25rem; margin-top: 1.4em; }
.single-article .entry-content blockquote {
  border-left: 4px solid var(--d360-accent);
  margin: 1.5em 0;
  padding: 4px 20px;
  color: var(--d360-text-muted);
  font-style: italic;
}
.single-article .entry-tags { margin-top: 32px; padding-top: 20px; border-top: 1px solid var(--d360-border); }
.single-article .entry-tags a {
  display: inline-block;
  background: var(--d360-card-bg);
  border: 1px solid var(--d360-border);
  border-radius: 3px;
  padding: 4px 10px;
  margin: 0 6px 6px 0;
  font-size: .82rem;
  color: var(--d360-text-muted);
}

.related-posts { max-width: var(--d360-max-width); margin: 40px auto 0; padding: 0 20px 48px; }

/* ---------------------------------------------------------------------
   Archive / category
--------------------------------------------------------------------- */
.archive-header {
  background: var(--d360-header-bg);
  color: #fff;
  padding: 28px 0;
  margin-bottom: 32px;
}
.archive-header h1 { color: #fff; margin: 0; text-transform: uppercase; }
.archive-content { padding-bottom: 48px; }

.pagination { display: flex; gap: 10px; justify-content: center; margin: 36px 0; }
.pagination a, .pagination span {
  padding: 8px 14px;
  border: 1px solid var(--d360-border);
  border-radius: 3px;
  color: var(--d360-text);
}
.pagination .current { background: var(--d360-accent); color: #fff; border-color: var(--d360-accent); }

/* ---------------------------------------------------------------------
   Newsletter
--------------------------------------------------------------------- */
.newsletter-box {
  background: var(--d360-card-bg);
  border: 1px solid var(--d360-border);
  border-radius: 6px;
  padding: 24px 28px;
  margin-top: 32px;
}
.newsletter-box h3 { margin: 0 0 6px; font-size: 1.2rem; }
.newsletter-box > .newsletter-text p { margin: 0 0 16px; color: var(--d360-text-muted); }
.newsletter-fields { display: flex; gap: 10px; flex-wrap: wrap; }
.newsletter-fields input[type="email"] {
  flex: 1;
  min-width: 220px;
  padding: 10px 14px;
  border: 1px solid var(--d360-border);
  border-radius: 4px;
  font-size: 1rem;
}
.newsletter-fields button {
  background: var(--d360-accent);
  color: #fff;
  border: none;
  padding: 10px 22px;
  border-radius: 4px;
  font-weight: 600;
  cursor: pointer;
}
.newsletter-fields button:hover { background: var(--d360-accent-dark); }
.newsletter-consent {
  display: block;
  margin-top: 10px;
  font-size: .82rem;
  color: var(--d360-text-muted);
}
.newsletter-msg { font-weight: 600; padding: 8px 0; }
.newsletter-msg.ok { color: #2f6b2f; }
.newsletter-msg.error { color: #a33; }

/* ---------------------------------------------------------------------
   Footer
--------------------------------------------------------------------- */
.site-footer {
  background: var(--d360-header-bg);
  color: #9aa4b1;
  padding: 36px 0;
  margin-top: 48px;
  font-size: .88rem;
}
.site-footer .footer-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.footer-brand {
  font-family: 'Oswald', Arial, sans-serif;
  color: #fff;
  font-size: 1.1rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  margin: 0;
}
.footer-cats { display: flex; flex-wrap: wrap; gap: 8px; }
.footer-cats a {
  color: #c7ced7;
  font-size: .82rem;
  padding: 5px 12px;
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 20px;
}
.footer-cats a:hover { color: #fff; border-color: rgba(255,255,255,.4); text-decoration: none; }
.site-footer .copyright {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid rgba(255,255,255,.08);
  font-size: .8rem;
}
.site-footer .copyright a { color: #c7ced7; }

/* ---------------------------------------------------------------------
   Responsive
--------------------------------------------------------------------- */
@media (max-width: 780px) {
  .featured-story { grid-template-columns: 1fr; }
  .site-footer .footer-grid { grid-template-columns: 1fr; }
  .primary-nav ul { gap: 0; }
}
