/*
Theme Name: Openmateria
Theme URI: https://openfilms.com
Author: Openmateria
Description: Tema oscuro tipo revista científica inspirado en Openmateria. Optimizado para AdSense, SEO y contenido largo sobre ciencia, tecnología y cultura.
Version: 1.0.0
Requires at least: 6.0
Tested up to: 6.7
Requires PHP: 7.4
License: GNU General Public License v2 or later
Text Domain: openmateria
Tags: dark, magazine, blog, science, custom-menu, featured-images, translation-ready
*/

/* ========== FONTS ========== */
@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=Instrument+Serif:ital@0;1&family=Space+Grotesk:wght@400;500;600;700&display=swap');

/* ========== CSS VARIABLES ========== */
:root {
  --background: 240 12% 5%;
  --foreground: 40 20% 96%;
  --card: 240 10% 8%;
  --card-foreground: 40 20% 96%;
  --primary: 24 95% 55%;
  --primary-foreground: 240 12% 5%;
  --muted: 240 8% 14%;
  --muted-foreground: 240 6% 62%;
  --border: 240 8% 18%;
  --radius: 0.25rem;

  /* Category colors (HSL) */
  --cat-espacio: 175 70% 45%;
  --cat-universo: 265 70% 65%;
  --cat-tecnologia: 205 90% 55%;
  --cat-quimica: 24 95% 55%;
  --cat-matematica: 48 95% 55%;
  --cat-cultura: 350 75% 58%;
}

/* ========== BASE ========== */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: "Space Grotesk", system-ui, -apple-system, sans-serif;
  background-color: hsl(var(--background));
  color: hsl(var(--foreground));
  line-height: 1.6;
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
  transition: color 0.2s ease;
}
a:hover { color: hsl(var(--primary)); }

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

h1, h2, h3, h4, h5, h6 {
  margin: 0 0 0.5em;
  font-weight: 700;
  line-height: 1.15;
  color: hsl(var(--foreground));
}

.font-display {
  font-family: "Bebas Neue", Impact, sans-serif;
  letter-spacing: 0.01em;
  font-weight: 400;
}

.font-serif-ed {
  font-family: "Instrument Serif", Georgia, serif;
}

/* Grain overlay */
.grain::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 60;
  opacity: 0.045;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ========== HEADER ========== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid hsl(var(--border) / 0.7);
  background: hsl(var(--background) / 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.header-inner {
  max-width: 90rem;
  margin: 0 auto;
  padding: 0 1.25rem;
  height: 4rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

@media (min-width: 640px) {
  .header-inner { padding: 0 2rem; }
}

.site-branding {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-shrink: 0;
}

.logo-icon {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
}

.logo-icon svg {
  width: 1rem;
  height: 1rem;
  fill: currentColor;
}

.site-title {
  font-family: "Bebas Neue", Impact, sans-serif;
  font-size: 1.5rem;
  line-height: 1;
  letter-spacing: 0.02em;
  margin: 0;
  color: hsl(var(--foreground));
}
.site-title .accent { color: hsl(var(--primary)); }

/* Navigation */
.main-navigation {
  margin-left: auto;
  display: none;
}

@media (min-width: 1024px) {
  .main-navigation { display: block; }
}

.main-navigation ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.main-navigation a {
  display: block;
  padding: 0.5rem 0.75rem;
  font-size: 13px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: hsl(var(--muted-foreground));
  transition: color 0.2s ease;
}

.main-navigation a:hover,
.main-navigation .current-menu-item > a,
.main-navigation .current_page_item > a {
  color: hsl(var(--foreground));
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
}

@media (min-width: 1024px) {
  .header-actions { margin-left: 0; }
}

.btn-subscribe {
  display: none;
  align-items: center;
  height: 2.25rem;
  padding: 0 1rem;
  background: hsl(var(--foreground));
  color: hsl(var(--background)) !important;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  transition: background 0.2s ease, color 0.2s ease;
}

@media (min-width: 640px) {
  .btn-subscribe { display: inline-flex; }
}

.btn-subscribe:hover {
  background: hsl(var(--primary)) !important;
  color: hsl(var(--primary-foreground)) !important;
}

.menu-toggle {
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  border: 1px solid hsl(var(--border));
  background: transparent;
  color: hsl(var(--foreground));
  cursor: pointer;
}

@media (min-width: 1024px) {
  .menu-toggle { display: none; }
}

/* Mobile menu */
.mobile-nav {
  display: none;
  border-top: 1px solid hsl(var(--border));
  background: hsl(var(--card));
  padding: 0.75rem 1.25rem;
}

.mobile-nav.is-open { display: block; }

.mobile-nav a {
  display: block;
  padding: 0.75rem 0;
  font-size: 14px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: hsl(var(--muted-foreground));
  border-bottom: 1px solid hsl(var(--border) / 0.5);
}

.mobile-nav a:hover { color: hsl(var(--primary)); }

/* ========== TICKER ========== */
.ticker {
  overflow: hidden;
  border-bottom: 1px solid hsl(var(--border));
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
}

.ticker-track {
  display: flex;
  width: max-content;
  animation: marquee 32s linear infinite;
  padding: 0.5rem 0;
}

.ticker-item {
  display: flex;
  align-items: center;
  white-space: nowrap;
  padding: 0 1.5rem;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.22em;
}

.ticker-dot {
  margin-left: 1.5rem;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: hsl(var(--primary-foreground) / 0.6);
}

@keyframes marquee {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

@media (prefers-reduced-motion: reduce) {
  .ticker-track { animation: none; }
}

/* ========== HERO ========== */
.hero {
  position: relative;
  min-height: 100dvh;
  width: 100%;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
}

.hero-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, hsl(var(--background)) 0%, hsl(var(--background) / 0.8) 45%, hsl(var(--background) / 0.25) 100%);
  z-index: 1;
}

.hero-content {
  position: relative;
  z-index: 2;
  max-width: 90rem;
  width: 100%;
  margin: 0 auto;
  padding: 7rem 1.25rem 4rem;
}

@media (min-width: 640px) {
  .hero-content { padding: 7rem 2rem 4rem; }
}

.hero-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.cat-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.5rem;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.2em;
}

.cat-espacio { background: hsl(var(--cat-espacio) / 0.15); color: hsl(var(--cat-espacio)); }
.cat-universo { background: hsl(var(--cat-universo) / 0.15); color: hsl(var(--cat-universo)); }
.cat-tecnologia { background: hsl(var(--cat-tecnologia) / 0.15); color: hsl(var(--cat-tecnologia)); }
.cat-quimica { background: hsl(var(--cat-quimica) / 0.15); color: hsl(var(--cat-quimica)); }
.cat-matematica { background: hsl(var(--cat-matematica) / 0.15); color: hsl(var(--cat-matematica)); }
.cat-cultura { background: hsl(var(--cat-cultura) / 0.15); color: hsl(var(--cat-cultura)); }

.hero-date {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: hsl(var(--muted-foreground));
}

.hero h1 {
  margin-top: 1.25rem;
  font-family: "Bebas Neue", Impact, sans-serif;
  font-size: clamp(2.5rem, 13vw, 5.5rem);
  line-height: 0.9;
  letter-spacing: 0.01em;
  max-width: 18ch;
}

.hero-dek {
  margin-top: 1.5rem;
  max-width: 42rem;
  font-family: "Instrument Serif", Georgia, serif;
  font-size: clamp(1.15rem, 2.5vw, 1.5rem);
  line-height: 1.35;
  color: hsl(var(--foreground) / 0.75);
}

.hero-actions {
  margin-top: 2rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 44px;
  padding: 0 1.5rem;
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground)) !important;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  transition: transform 0.15s ease, opacity 0.2s ease;
}
.btn-primary:hover {
  opacity: 0.9;
  color: hsl(var(--primary-foreground)) !important;
  transform: scale(0.98);
}

.read-time {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: hsl(var(--muted-foreground));
}

/* ========== SECTIONS ========== */
.section {
  max-width: 90rem;
  margin: 0 auto;
  padding: 4rem 1.25rem;
}

@media (min-width: 640px) {
  .section { padding: 4rem 2rem; }
}

.section-title {
  font-family: "Bebas Neue", Impact, sans-serif;
  font-size: clamp(2rem, 5vw, 3rem);
  letter-spacing: 0.01em;
  margin-bottom: 0.25em;
}

/* Featured grid (2 cards) */
.featured-grid {
  display: grid;
  gap: 1px;
  background: hsl(var(--border));
}

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

.article-card {
  background: hsl(var(--background));
  padding: 1.5rem;
  transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

@media (min-width: 640px) {
  .article-card { padding: 2.25rem; }
}

.article-card:hover { transform: translateY(-4px); }

.article-card img {
  aspect-ratio: 3/2;
  width: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.article-card:hover img { transform: scale(1.03); }

.article-card .img-wrap {
  overflow: hidden;
}

.article-card h2 {
  margin-top: 1rem;
  font-family: "Instrument Serif", Georgia, serif;
  font-size: clamp(1.5rem, 3vw, 2.25rem);
  font-weight: 400;
  line-height: 1.2;
}

.article-card .excerpt {
  margin-top: 0.75rem;
  font-size: 0.9rem;
  color: hsl(var(--muted-foreground));
  line-height: 1.55;
}

/* Quote / Manifesto */
.manifesto {
  border-top: 1px solid hsl(var(--border));
  border-bottom: 1px solid hsl(var(--border));
  background: hsl(var(--card) / 0.5);
  padding: 5rem 1.25rem;
}

.manifesto-inner {
  max-width: 72rem;
  margin: 0 auto;
  display: grid;
  gap: 2rem;
}

@media (min-width: 768px) {
  .manifesto-inner {
    grid-template-columns: auto 1fr;
    align-items: start;
    gap: 2rem;
  }
}

.manifesto-quote {
  font-family: "Bebas Neue", Impact, sans-serif;
  font-size: clamp(4rem, 10vw, 6rem);
  color: hsl(var(--primary));
  line-height: 1;
}

.manifesto-text {
  font-family: "Instrument Serif", Georgia, serif;
  font-size: clamp(1.35rem, 3vw, 1.85rem);
  line-height: 1.35;
}

.manifesto-author {
  margin-top: 2rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.manifesto-author img {
  width: 3.5rem;
  height: 3.5rem;
  object-fit: cover;
  border-radius: 0;
}

.manifesto-author .name {
  font-size: 0.9rem;
  font-weight: 600;
}

.manifesto-author .role {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: hsl(var(--muted-foreground));
}

/* Explore topics */
.topics-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 2rem;
}

.topic-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 44px;
  padding: 0 1.25rem;
  border: 1px solid hsl(var(--border));
  font-size: 0.875rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.topic-link:hover {
  border-color: currentColor;
}

/* Recent posts list */
.posts-list {
  list-style: none;
  margin: 2rem 0 0;
  padding: 0;
  border-top: 1px solid hsl(var(--border));
}

.posts-list li {
  border-bottom: 1px solid hsl(var(--border));
}

.posts-list a {
  display: grid;
  gap: 1.25rem;
  padding: 1.75rem 0;
  align-items: center;
}

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

.posts-list img {
  aspect-ratio: 3/2;
  width: 100%;
  object-fit: cover;
}

@media (min-width: 640px) {
  .posts-list img { width: 9rem; }
}

.posts-list h3 {
  margin-top: 0.75rem;
  font-size: clamp(1.15rem, 2.5vw, 1.5rem);
  font-weight: 600;
  line-height: 1.25;
  transition: color 0.2s ease;
}

.posts-list a:hover h3 { color: hsl(var(--primary)); }

.posts-list .meta {
  margin-top: 0.5rem;
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
}

.posts-list .time {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: hsl(var(--muted-foreground));
}

/* Newsletter */
.newsletter {
  border-top: 1px solid hsl(var(--border));
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  padding: 4rem 1.25rem;
}

.newsletter-inner {
  max-width: 72rem;
  margin: 0 auto;
  display: grid;
  gap: 2rem;
}

@media (min-width: 768px) {
  .newsletter-inner {
    grid-template-columns: 1fr 1fr;
    align-items: center;
  }
}

.newsletter h2 {
  font-family: "Bebas Neue", Impact, sans-serif;
  font-size: clamp(2.5rem, 6vw, 3.5rem);
  line-height: 1;
  color: hsl(var(--primary-foreground));
}

.newsletter p {
  margin-top: 0.75rem;
  max-width: 28rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: hsl(var(--primary-foreground) / 0.8);
}

.newsletter-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

@media (min-width: 640px) {
  .newsletter-form { flex-direction: row; }
}

.newsletter-form input[type="email"] {
  min-height: 48px;
  flex: 1;
  padding: 0 1rem;
  border: 1px solid hsl(var(--primary-foreground) / 0.3);
  background: hsl(var(--primary-foreground) / 0.1);
  color: hsl(var(--primary-foreground));
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
}

.newsletter-form input::placeholder {
  color: hsl(var(--primary-foreground) / 0.6);
}

.newsletter-form button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 48px;
  padding: 0 1.5rem;
  background: hsl(var(--primary-foreground));
  color: hsl(var(--primary));
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  border: none;
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.15s ease;
}

.newsletter-form button:hover { transform: scale(0.98); }

/* ========== FOOTER ========== */
.site-footer {
  border-top: 1px solid hsl(var(--border));
  background: hsl(var(--card) / 0.6);
}

.footer-inner {
  max-width: 90rem;
  margin: 0 auto;
  padding: 3.5rem 1.25rem;
  display: grid;
  gap: 2.5rem;
}

@media (min-width: 768px) {
  .footer-inner {
    grid-template-columns: 1.4fr 1fr 1fr;
    padding: 3.5rem 2rem;
  }
}

.footer-brand {
  font-family: "Bebas Neue", Impact, sans-serif;
  font-size: 1.85rem;
  letter-spacing: 0.02em;
}

.footer-brand .accent { color: hsl(var(--primary)); }

.footer-desc {
  margin-top: 0.75rem;
  max-width: 22rem;
  font-size: 0.9rem;
  line-height: 1.55;
  color: hsl(var(--muted-foreground));
}

.footer-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: hsl(var(--muted-foreground));
}

.footer-links {
  list-style: none;
  margin: 1rem 0 0;
  padding: 0;
}

.footer-links li { margin-bottom: 0.5rem; }

.footer-links a {
  font-size: 0.9rem;
  color: hsl(var(--foreground) / 0.8);
}
.footer-links a:hover { color: hsl(var(--primary)); }

.footer-bottom {
  border-top: 1px solid hsl(var(--border) / 0.7);
  padding: 1.25rem;
  text-align: center;
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
}

/* ========== SINGLE / CONTENT ========== */
.site-main {
  max-width: 48rem;
  margin: 0 auto;
  padding: 3rem 1.25rem 5rem;
}

.entry-header { margin-bottom: 2.5rem; }

.entry-title {
  font-family: "Bebas Neue", Impact, sans-serif;
  font-size: clamp(2.2rem, 6vw, 3.5rem);
  line-height: 0.95;
  letter-spacing: 0.01em;
  margin-top: 1rem;
}

.entry-meta {
  margin-top: 1rem;
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
}

.entry-content {
  font-size: 1.1rem;
  line-height: 1.75;
}

.entry-content p { margin-bottom: 1.5em; }

.entry-content h2,
.entry-content h3 {
  font-family: "Bebas Neue", Impact, sans-serif;
  letter-spacing: 0.02em;
  margin-top: 2em;
}

.entry-featured {
  margin-bottom: 2.5rem;
  aspect-ratio: 16/9;
  overflow: hidden;
}

.entry-featured img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Archive */
.archive-header {
  max-width: 90rem;
  margin: 0 auto;
  padding: 4rem 1.25rem 2rem;
}

.archive-title {
  font-family: "Bebas Neue", Impact, sans-serif;
  font-size: clamp(2.5rem, 7vw, 4rem);
}

/* Utility */
.screen-reader-text {
  border: 0;
  clip: rect(1px, 1px, 1px, 1px);
  clip-path: inset(50%);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  width: 1px;
  word-wrap: normal !important;
}

/* WordPress specifics */
.wp-block-image { margin: 2rem 0; }
.alignwide { max-width: 90rem; margin-left: auto; margin-right: auto; }
.alignfull { width: 100vw; max-width: 100vw; margin-left: calc(50% - 50vw); }

/* AdSense friendly spacing */
.adsense-slot {
  margin: 2.5rem 0;
  text-align: center;
  min-height: 90px;
}
