/*
Theme Name: Eurospace MAG
Author: Eurospace MAG
Description: Magazine de series, cine, tecnología y reviews en español para lectores de España y Latinoamérica.
Version: 2.0.0
Requires at least: 6.0
Requires PHP: 7.4
Text Domain: esmag
*/

/* ==========================================================================
   TOKENS
   ========================================================================== */
:root{
  --bg:#F6F7F9;
  --surface:#FFFFFF;
  --surface-2:#EEF1F5;
  --border:#DCE1E8;
  --ink:#10151C;
  --ink-muted:#4E5765;
  --ink-faint:#88909B;

  --brand:#C8102E;
  --brand-dk:#9B0C22;
  --brand-ink:#FFFFFF;
  --brand-soft:#FCE8EB;

  --accent:#FFC400;
  --accent-dk:#D9A400;
  --accent-ink:#1F1600;

  --good:#1E8E5A;
  --good-soft:#E5F5ED;

  --mono-tint:#EEF1F5;
  --radius:14px;
  --radius-sm:9px;
  --shadow:0 1px 2px rgba(16,21,28,.04), 0 10px 28px -16px rgba(16,21,28,.16);
  --container:1280px;
}
@media (prefers-color-scheme: dark){
  :root:not([data-theme="light"]){
    --bg:#0D1117;
    --surface:#151B23;
    --surface-2:#1B2330;
    --border:#293241;
    --ink:#E7EAEE;
    --ink-muted:#9CA6B3;
    --ink-faint:#66707D;

    --brand:#FF5A5F;
    --brand-dk:#C8102E;
    --brand-ink:#2A0508;
    --brand-soft:rgba(255,90,95,.14);

    --accent:#FFCC33;
    --accent-dk:#E6B000;
    --accent-ink:#1F1600;

    --good:#4FBE85;
    --good-soft:rgba(79,190,133,.13);

    --mono-tint:#1C242F;
    --shadow:0 1px 2px rgba(0,0,0,.35), 0 10px 28px -16px rgba(0,0,0,.55);
  }
}
:root[data-theme="dark"]{
  --bg:#0D1117; --surface:#151B23; --surface-2:#1B2330; --border:#293241;
  --ink:#E7EAEE; --ink-muted:#9CA6B3; --ink-faint:#66707D;
  --brand:#FF5A5F; --brand-dk:#C8102E; --brand-ink:#2A0508; --brand-soft:rgba(255,90,95,.14);
  --accent:#FFCC33; --accent-dk:#E6B000; --accent-ink:#1F1600;
  --good:#4FBE85; --good-soft:rgba(79,190,133,.13);
  --mono-tint:#1C242F;
  --shadow:0 1px 2px rgba(0,0,0,.35), 0 10px 28px -16px rgba(0,0,0,.55);
}

/* ==========================================================================
   RESET / BASE
   ========================================================================== */
*,*::before,*::after{ box-sizing:border-box; }
html{ -webkit-text-size-adjust:100%; }
body{
  margin:0; background:var(--bg); color:var(--ink);
  font-family:'Source Sans 3',-apple-system,'Segoe UI',sans-serif;
  font-size:16px; line-height:1.5;
}
img{ max-width:100%; display:block; }
a{ color:inherit; text-decoration:none; }
h1,h2,h3,h4,h5{ font-family:'Archivo',-apple-system,sans-serif; text-wrap:balance; margin:0; color:var(--ink); font-weight:800; letter-spacing:-.01em; }
p{ margin:0; }
ul{ margin:0; padding:0; }
button{ font-family:inherit; cursor:pointer; }
.mono{ font-family:'JetBrains Mono','SFMono-Regular',Consolas,monospace; }
[hidden]{ display:none!important; }

.container{ max-width:var(--container); margin-inline:auto; padding-inline:20px; }
.section{ padding-block:64px; }
.section-alt{ background:var(--surface); }

.eyebrow{ font-family:'JetBrains Mono',monospace; font-size:.72rem; letter-spacing:.12em; text-transform:uppercase; color:var(--brand); font-weight:600; }
.section-head{ display:flex; flex-direction:column; gap:10px; margin-bottom:34px; max-width:60ch; }
.section-head h2{ font-size:clamp(1.5rem,3vw,2.1rem); }
.section-head p{ color:var(--ink-muted); font-size:1rem; line-height:1.6; }

/* ==========================================================================
   BUTTONS
   ========================================================================== */
.btn{ display:inline-flex; align-items:center; justify-content:center; gap:8px; font-weight:700; font-size:.94rem; padding:13px 22px; border-radius:99px; border:1px solid transparent; transition:transform .15s,background .15s,border-color .15s; }
.btn:active{ transform:translateY(1px); }
.btn-primary{ background:var(--brand); color:var(--brand-ink); }
.btn-primary:hover{ background:var(--brand-dk); }
.btn-accent{ background:var(--accent); color:var(--accent-ink); }
.btn-accent:hover{ background:var(--accent-dk); }
.btn-outline{ background:transparent; border-color:var(--border); color:var(--ink); }
.btn-outline:hover{ border-color:var(--brand); color:var(--brand); }
.btn-block{ width:100%; }

/* ==========================================================================
   HEADER
   ========================================================================== */
.site-header{ position:sticky; top:0; z-index:40; background:color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter:blur(10px); border-bottom:1px solid var(--border); padding-top:env(safe-area-inset-top,0px); }
.header-inner{ display:flex; align-items:center; gap:24px; padding-block:14px; }
.logo{ display:flex; align-items:center; gap:9px; font-family:'Archivo',sans-serif; font-weight:900; font-size:1.18rem; color:var(--ink); }
.logo .dot{ width:9px; height:9px; border-radius:50%; background:var(--accent); }
.logo span.eu{ color:var(--brand); }
.main-nav{ display:flex; gap:22px; margin-inline:auto; }
.main-nav a{ font-size:.9rem; font-weight:600; color:var(--ink-muted); }
.main-nav a:hover{ color:var(--ink); }
.header-cta{ display:flex; align-items:center; gap:10px; }
.nav-burger{ display:none; background:none; border:none; padding:8px; }
.nav-burger span{ display:block; width:20px; height:2px; background:var(--ink); margin:4px 0; border-radius:2px; }

.hero-actions{ display:flex; gap:12px; flex-wrap:wrap; margin-top:26px; }
.screen-reader-text{ position:absolute!important; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0; }

/* ==========================================================================
   PORTADA MAGAZINE
   ========================================================================== */
/* Piezas comunes */
.mag-kicker{ display:inline-block; font-family:'JetBrains Mono',monospace; font-size:.7rem; font-weight:700; letter-spacing:.1em; text-transform:uppercase; color:var(--brand); }
.mag-kicker:hover{ text-decoration:underline; text-underline-offset:3px; }
.mag-meta{ font-size:.78rem; color:var(--ink-faint); }
.mag-thumb{ display:block; aspect-ratio:16/9; overflow:hidden; border-radius:var(--radius-sm); background:linear-gradient(135deg,var(--brand-soft),var(--surface-2)); }
.mag-thumb img{ width:100%; height:100%; object-fit:cover; transition:transform .35s ease; }
.mag-thumb:hover img, .mag-card:hover .mag-thumb img{ transform:scale(1.03); }
.mag-thumb-empty{ display:flex; width:100%; height:100%; align-items:center; justify-content:center; font-size:2rem; }
.mag-heading{ display:flex; align-items:baseline; justify-content:space-between; gap:12px; border-top:3px solid var(--brand); padding-top:10px; margin-bottom:18px; }
.mag-heading h2{ font-size:1.15rem; text-transform:uppercase; letter-spacing:.03em; }
.mag-heading a{ font-size:.8rem; font-weight:700; color:var(--brand); white-space:nowrap; }
.mag-heading a:hover{ text-decoration:underline; text-underline-offset:3px; }

/* Destacado + Tendencias */
.mag-top{ padding-block:32px 8px; }
.mag-top-grid{ display:grid; grid-template-columns:minmax(0,1.7fr) minmax(0,1fr); gap:40px; align-items:start; }
.mag-featured .mag-thumb{ border-radius:var(--radius); }
.mag-featured-body{ padding-top:18px; display:flex; flex-direction:column; gap:12px; }
.mag-featured-tags{ display:flex; align-items:center; gap:12px; flex-wrap:wrap; }
.mag-badge{ background:var(--accent); color:var(--accent-ink); font-size:.66rem; font-weight:800; text-transform:uppercase; letter-spacing:.08em; padding:4px 9px; border-radius:4px; }
.mag-featured h1{ font-size:clamp(1.7rem,3.4vw,2.7rem); line-height:1.08; letter-spacing:-.02em; }
.mag-featured h1 a:hover{ color:var(--brand); }
.mag-featured p{ color:var(--ink-muted); font-size:1.05rem; line-height:1.6; max-width:65ch; }
.mag-empty{ padding-block:48px; }
.mag-empty p{ color:var(--ink-muted); margin-top:12px; }

/* Listas numeradas (Tendencias y Lo más leído) */
.mag-rank{ list-style:none; margin:0; padding:0; counter-reset:rank; }
.mag-rank li{ counter-increment:rank; display:grid; grid-template-columns:2.4rem minmax(0,1fr); gap:12px; padding-block:14px; border-bottom:1px solid var(--border); }
.mag-rank li:first-child{ padding-top:0; }
.mag-rank li:last-child{ border-bottom:none; }
.mag-rank li::before{ content:counter(rank); font-family:'Archivo',sans-serif; font-weight:900; font-size:2rem; line-height:1; color:var(--brand); }
.mag-rank h3{ font-size:1rem; line-height:1.3; margin-block:4px; }
.mag-rank h3 a:hover{ color:var(--brand); }
.mag-rank--compact li::before{ font-size:1.5rem; color:var(--ink-faint); }
.mag-rank--compact h3{ font-size:.95rem; margin-top:0; }

/* Franjas + lateral */
.mag-layout{ display:grid; grid-template-columns:minmax(0,1fr) 300px; gap:44px; align-items:start; padding-block:36px 72px; }
.mag-main{ display:flex; flex-direction:column; gap:48px; container-type:inline-size; min-width:0; }
.mag-aside{ position:sticky; top:88px; display:flex; flex-direction:column; gap:36px; }
.mag-strip-grid{ display:grid; grid-template-columns:minmax(0,1fr); gap:20px; }
.mag-card{ display:flex; flex-direction:column; gap:10px; min-width:0; }
.mag-card-body{ display:flex; flex-direction:column; gap:6px; min-width:0; }
.mag-card-title{ font-size:1.02rem; line-height:1.3; }
.mag-card-title a:hover{ color:var(--brand); }
@container (max-width:479px){
  .mag-card{ flex-direction:row; gap:14px; }
  .mag-card .mag-thumb{ flex:0 0 40%; align-self:flex-start; }
  .mag-card-title{ font-size:.95rem; }
}
@container (min-width:480px){ .mag-strip-grid{ grid-template-columns:repeat(2,minmax(0,1fr)); gap:26px 20px; } }
@container (min-width:760px){ .mag-strip-grid{ grid-template-columns:repeat(4,minmax(0,1fr)); } }

/* Newsletter */
.mag-newsletter{ background:var(--surface); border:1px solid var(--border); border-top:4px solid var(--accent); border-radius:var(--radius); padding:22px; box-shadow:var(--shadow); scroll-margin-top:96px; }
.mag-newsletter h2{ font-size:1.2rem; line-height:1.25; margin-top:8px; }
.mag-newsletter > p{ font-size:.88rem; color:var(--ink-muted); line-height:1.55; margin:8px 0 16px; }
.mag-newsletter .lead-form{ background:none; box-shadow:none; padding:0; border-radius:0; }

/* ==========================================================================
   CARDS / GRIDS
   ========================================================================== */
.grid-3{ display:grid; grid-template-columns:repeat(3,1fr); gap:20px; }
.grid-2{ display:grid; grid-template-columns:repeat(2,1fr); gap:20px; }

.guide-card{ background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); overflow:hidden; box-shadow:var(--shadow); display:flex; flex-direction:column; transition:transform .15s; }
.guide-card:hover{ transform:translateY(-3px); }
.guide-thumb{ aspect-ratio:16/10; background:linear-gradient(135deg,var(--brand-soft),var(--surface-2)); display:flex; align-items:center; justify-content:center; }
.guide-thumb .flag{ font-size:2.2rem; }
.guide-body{ padding:20px; display:flex; flex-direction:column; gap:8px; flex:1; }
.guide-tag{ font-size:.68rem; font-weight:700; text-transform:uppercase; letter-spacing:.06em; color:var(--brand); }
.guide-body h3{ font-size:1.08rem; line-height:1.3; }
.guide-body p{ font-size:.86rem; color:var(--ink-muted); line-height:1.55; }
.guide-meta{ margin-top:auto; padding-top:10px; font-size:.76rem; color:var(--ink-faint); display:flex; justify-content:space-between; }

.trust-strip{ display:flex; flex-wrap:wrap; gap:14px; justify-content:center; }
.trust-pill{ display:flex; align-items:center; gap:8px; background:var(--surface); border:1px solid var(--border); border-radius:99px; padding:9px 16px; font-size:.82rem; font-weight:600; color:var(--ink-muted); box-shadow:var(--shadow); }
.trust-pill svg{ width:15px; height:15px; color:var(--good); }

/* ==========================================================================
   FORMULARIO DE CAPTACIÓN
   ========================================================================== */
.lead-form{ background:var(--surface); border-radius:var(--radius); padding:26px; box-shadow:var(--shadow); }
.lead-form .ebook-title{ font-family:'Archivo',sans-serif; font-weight:800; font-size:1.05rem; color:var(--ink); margin-bottom:4px; }
.lead-form .ebook-sub{ font-size:.82rem; color:var(--ink-muted); margin-bottom:16px; }
.lead-form input[type="email"]{ width:100%; padding:13px 14px; border-radius:var(--radius-sm); border:1px solid var(--border); background:var(--bg); color:var(--ink); font-size:.92rem; font-family:inherit; margin-bottom:10px; }
.lead-form .fine{ font-size:.7rem; color:var(--ink-faint); margin-top:10px; line-height:1.5; }
.lead-status{ font-size:.82rem; margin-top:10px; font-weight:600; }
.lead-status.ok{ color:var(--good); }
.lead-status.err{ color:var(--brand); }
.lead-status:empty{ display:none; }
.lead-consent{ display:flex; align-items:flex-start; gap:9px; font-size:.8rem; line-height:1.45; color:var(--ink-muted); margin-bottom:12px; cursor:pointer; }
.lead-consent input{ width:16px; height:16px; margin:2px 0 0; flex-shrink:0; accent-color:var(--brand); }
.lead-consent a{ color:var(--brand); text-decoration:underline; text-underline-offset:2px; }
.hp-field{ position:absolute!important; left:-9999px; width:1px; height:1px; overflow:hidden; }

/* Página de resultado de la newsletter (confirmar / baja) */
.nl-status{ max-width:60ch; margin-inline:auto; text-align:center; padding-block:24px; }
.nl-status h1{ font-size:clamp(1.7rem,4vw,2.4rem); margin-top:12px; }
.nl-status p{ color:var(--ink-muted); font-size:1.05rem; line-height:1.6; margin-top:14px; }
.nl-status .hero-actions{ justify-content:center; }

/* ==========================================================================
   FOOTER
   ========================================================================== */
.site-footer{ border-top:1px solid var(--border); background:var(--surface); padding-block:48px 30px; padding-bottom:calc(30px + env(safe-area-inset-bottom,0px)); }
.footer-grid{ display:grid; grid-template-columns:1.4fr 1fr 1fr 1fr; gap:32px; }
.footer-desc{ font-size:.86rem; color:var(--ink-muted); line-height:1.6; max-width:34ch; margin-top:12px; }
.footer-col h4{ font-family:'Source Sans 3',sans-serif; font-weight:700; font-size:.78rem; text-transform:uppercase; letter-spacing:.06em; color:var(--ink-faint); margin-bottom:14px; }
.footer-col a{ display:block; font-size:.88rem; color:var(--ink-muted); padding-block:6px; }
.footer-col a:hover{ color:var(--brand); }
.footer-bottom{ margin-top:40px; padding-top:22px; border-top:1px solid var(--border); display:flex; justify-content:space-between; flex-wrap:wrap; gap:10px; font-size:.78rem; color:var(--ink-faint); }
.affiliate-disclosure{ font-size:.74rem; color:var(--ink-faint); line-height:1.6; max-width:80ch; margin-top:18px; padding-top:18px; border-top:1px dashed var(--border); }

/* ==========================================================================
   SINGLE / BLOG
   ========================================================================== */
.post-header{ padding-block:48px 30px; }
.post-header .eyebrow{ margin-bottom:12px; }
.post-header h1{ font-size:clamp(1.8rem,4vw,2.6rem); }
.post-meta{ display:flex; gap:16px; margin-top:16px; font-size:.84rem; color:var(--ink-faint); }
.post-content{ max-width:72ch; font-size:1.02rem; line-height:1.75; color:var(--ink); display:flex; flex-direction:column; gap:18px; }
.post-content h2{ font-size:1.5rem; margin-top:10px; }
.post-content h3{ font-size:1.2rem; }
.post-content p{ color:var(--ink); }
.post-content ul, .post-content ol{ padding-left:22px; display:flex; flex-direction:column; gap:8px; }
.post-content a{ color:var(--brand); text-decoration:underline; text-underline-offset:2px; }
.post-content a.btn{ text-decoration:none; }
.post-content a.btn-primary, .post-content a.btn-primary:hover{ color:#fff; }
.post-content img{ border-radius:var(--radius-sm); }
.post-cta{ margin-top:20px; background:var(--surface-2); border-radius:var(--radius); padding:24px; }

.archive-header{ padding-block:48px 30px; }
.post-list{ display:grid; grid-template-columns:repeat(3,1fr); gap:20px; }
.pagination{ display:flex; gap:8px; justify-content:center; margin-top:40px; }
.pagination a, .pagination span{ padding:9px 15px; border-radius:var(--radius-sm); border:1px solid var(--border); font-size:.86rem; font-weight:600; }
.pagination .current{ background:var(--brand); color:var(--brand-ink); border-color:var(--brand); }

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
/* El menú tiene 7 secciones: pasa a hamburguesa antes que el resto del layout */
@media (max-width:1120px){
  .main-nav{ display:none; }
  .main-nav.open{ display:flex; position:fixed; inset:0; top:64px; padding-top:env(safe-area-inset-top,0px); background:var(--bg); flex-direction:column; gap:4px; padding:24px; z-index:39; overflow-y:auto; }
  .main-nav.open a{ padding:14px 4px; border-bottom:1px solid var(--border); font-size:1.05rem; }
  .nav-burger{ display:block; }
  .header-cta{ margin-left:auto; }
}
@media (max-width:1000px){
  .mag-layout{ grid-template-columns:minmax(0,1fr); }
  .mag-aside{ position:static; display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:32px; align-items:start; }
}
@media (max-width:900px){
  .mag-top-grid{ grid-template-columns:minmax(0,1fr); gap:32px; }
  .grid-3{ grid-template-columns:1fr 1fr; }
  .footer-grid{ grid-template-columns:1fr 1fr; }
  .post-list{ grid-template-columns:1fr 1fr; }
}
@media (max-width:600px){
  .mag-aside{ grid-template-columns:minmax(0,1fr); }
  .mag-top{ padding-top:20px; }
  .grid-3{ grid-template-columns:1fr; }
  .footer-grid{ grid-template-columns:1fr; }
  .post-list{ grid-template-columns:1fr; }
  .hero-actions{ flex-direction:column; }
  .hero-actions .btn{ width:100%; }
}
