:root{--site-width:1350px;--green:#556b2f;}
*{margin:0;padding:0;box-sizing:border-box}
body{font-family:Segoe UI,Arial,sans-serif;background:#f3f2ef;color:#222}
.header-wrapper{background:var(--green);display:flex;justify-content:center;position:sticky;top:0;z-index:100}
.topbar{max-width:var(--site-width);width:100%;padding:15px 20px;display:flex;justify-content:space-between;align-items:center}
.logo{color:#fff;font-weight:700;font-size:1.2rem}
.topbar nav{display:flex;gap:18px}
.topbar a{text-decoration:none;color:#fff}
.container{max-width:var(--site-width);margin:24px auto;padding:0 20px;display:grid;grid-template-columns:260px 1fr 300px;gap:24px}
.card,.post-card{background:#fff;border-radius:13px;box-shadow:0 2px 5px rgba(0,0,0,.08)}
.card{padding:20px}
.sticky{position:sticky;top:90px}
.post-card{overflow:hidden;margin-bottom:24px;transition:.2s}
.post-card:hover{transform:translateY(-2px);box-shadow:0 8px 20px rgba(0,0,0,.1)}
.post-author{display:flex;gap:12px;padding:18px 24px 0}
.avatar{width:42px;height:42px;border-radius:50%;background:var(--green);color:#fff;display:flex;align-items:center;justify-content:center;font-weight:bold}
.author-info{display:flex;flex-direction:column}
.author-info span{font-size:.85rem;color:#666}
.post-header{padding:16px 24px 10px}
.tags{padding:0 24px 10px;display:flex;gap:8px;flex-wrap:wrap}
.tags span{background:#eef3e5;color:var(--green);padding:4px 10px;border-radius:20px;font-size:.8rem}
.post-image img{width:100%;display:block}
.post-content{padding:20px 24px;line-height:1.7}
.post-stats{padding:0 24px 12px;color:#666;font-size:.9rem}
.post-footer{display:flex;justify-content:space-between;gap:8px;border-top:1px solid #ececec;padding:8px 12px}
.action-btn{flex:1;display:flex;align-items:center;justify-content:center;gap:8px;background:transparent;border:none;padding:10px;border-radius:8px;cursor:pointer}
.action-btn:hover{background:#f3f5f7;color:var(--green)}
ul{list-style:none} li{padding:8px 0}
@media(max-width:1000px){.container{grid-template-columns:1fr}.sticky{position:static}.topbar{flex-direction:column;gap:10px}}

.header-left{
display:flex;
align-items:center;
gap:16px;
flex:1;
}

.logo img{
height:60px;
width:auto;
display:block;
}

.search-box{
width:420px;
max-width:100%;
}

.search-box input{
width:100%;
padding:10px 14px;
border:none;
border-radius:13px;
outline:none;
font-size:.95rem;
}

.topbar{
gap:20px;
}

.topbar nav{
margin-left:auto;
}

@media(max-width:1000px){
.header-left{
width:100%;
flex-direction:column;
align-items:stretch;
}

.search-box{
width:100%;
}

.topbar nav{
margin-left:0;
justify-content:center;
flex-wrap:wrap;
}
}


/* Alineación centrada del header */
.topbar{
    align-items:center !important;
}

.header-left{
    display:flex !important;
    align-items:center !important;
}

.logo{
    display:flex;
    align-items:center;
    justify-content:center;
}

.logo img{
    height:60px;
    display:block;
}

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

.search-box input{
    height:42px;
}

.topbar nav{
    display:flex;
    align-items:center;
    height:100%;
}

.topbar nav a{
    display:flex;
    align-items:center;
    justify-content:center;
    min-height:42px;
}

@media(max-width:1000px){
    .topbar,
    .header-left,
    .topbar nav{
        align-items:center !important;
    }
}


/* ===== RESPONSIVE TABLET ===== */
@media (max-width:1024px){
  .container{grid-template-columns:220px 1fr;gap:16px;}
  .right{display:none;}
  .topbar{flex-wrap:wrap;}
  .search-box{width:320px;}
  .topbar nav{flex-wrap:wrap;justify-content:center;}
}

/* ===== RESPONSIVE MOBILE ===== */
@media (max-width:768px){
  .container{grid-template-columns:1fr;padding:0 12px;}
  .left,.right{display:none;}
  .topbar{flex-direction:column;gap:12px;padding:12px;}
  .header-left{width:100%;flex-direction:column;gap:10px;}
  .logo img{height:50px;}
  .search-box,.search-box input{width:100%;}
  .topbar nav{width:100%;justify-content:center;flex-wrap:wrap;gap:8px;}
  .topbar nav a{font-size:.9rem;}
  .post-footer{flex-wrap:wrap;}
  .action-btn{min-width:48%;}
}

/* ===== SMALL MOBILE ===== */
@media (max-width:480px){
  .post-footer{display:grid;grid-template-columns:1fr 1fr;}
  .action-btn{width:100%;}
  .topbar nav a{font-size:.8rem;padding:6px 8px;}
  .post-header h2{font-size:1.2rem;}
}


.search-box{
position:relative;
}

.search-icon{
position:absolute;
left:12px;
top:50%;
transform:translateY(-50%);
opacity:.6;
pointer-events:none;
}

.search-box input{
padding-left:36px !important;
}

.menu-toggle{
display:none;
background:none;
border:none;
color:white;
font-size:28px;
cursor:pointer;
}

/* móvil */
@media (max-width:768px){

.menu-toggle{
display:block;
}

.topbar nav{
display:none;
width:100%;
}

body.menu-open .topbar nav{
display:flex;
flex-direction:column;
align-items:center;
}

.topbar nav a{
width:100%;
text-align:center;
padding:12px;
}

}


/* Corrección menú móvil */
@media (max-width:768px){

  .header-wrapper{
    position:sticky;
    top:0;
  }

  .topbar{
    flex-direction:row !important;
    flex-wrap:wrap;
    align-items:center;
    justify-content:space-between;
    padding:10px 12px;
  }

  .header-left{
    flex-direction:row !important;
    align-items:center;
    width:auto !important;
    flex:1;
  }

  .logo img{
    height:40px !important;
  }

  .search-box{
    flex:1;
    width:auto !important;
    max-width:220px;
  }

  .menu-toggle{
    display:block !important;
    margin-left:10px;
    font-size:30px;
    color:white;
    z-index:999;
  }

  .topbar nav{
    display:none;
    width:100%;
    order:3;
    margin-top:10px;
    background:#556b2f;
    border-top:1px solid rgba(255,255,255,.2);
  }

  body.menu-open .topbar nav{
    display:flex !important;
    flex-direction:column;
  }

  .topbar nav a{
    width:100%;
    padding:12px;
  }
}


@media (max-width:768px){
  .topbar nav{
    display:none !important;
  }

  body.menu-open .topbar nav{
    display:flex !important;
    flex-direction:column;
    width:100%;
  }
}


/* Menú móvil flotante sin aumentar altura del header */
@media (max-width:768px){

  .header-wrapper{
    position:sticky;
    top:0;
    z-index:1000;
  }

  .topbar{
    position:relative;
  }

  .topbar nav{
    display:none !important;
    position:absolute;
    top:100%;
    left:0;
    width:100%;
    background:#556b2f;
    border-radius:0 0 13px 13px;
    box-shadow:0 6px 15px rgba(0,0,0,.2);
    z-index:1001;
    margin-top:0 !important;
  }

  body.menu-open .topbar nav{
    display:flex !important;
    flex-direction:column;
  }

  .topbar nav a{
    border-bottom:1px solid rgba(255,255,255,.12);
  }

  .topbar nav a:last-child{
    border-bottom:none;
  }
}


/* Corrección menú hamburguesa: mostrar todas las opciones */
@media (max-width:768px){

  body.menu-open .topbar nav{
      display:flex !important;
      flex-direction:column !important;
      align-items:stretch !important;
      max-height:none !important;
      overflow:visible !important;
  }

  .topbar nav a{
      display:block !important;
      width:100% !important;
      text-align:center;
      padding:14px 12px !important;
      line-height:1.4;
  }
}


/* FIX DEFINITIVO MENU MOVIL */
@media (max-width:768px){

  .topbar nav,
  body.menu-open .topbar nav{
      align-items:stretch !important;
      justify-content:flex-start !important;
      height:auto !important;
  }

  body.menu-open .topbar nav a{
      display:block !important;
      flex:none !important;
      min-height:auto !important;
      height:auto !important;
      width:100% !important;
      padding:14px 12px !important;
  }
}
