/*
Theme Name: HG Técnicos
Theme URI: https://tecnicosconstruccionhg.es
Author: Técnicos Construcción HG
Description: Tema ligero y a medida para Técnicos Construcción HG. Identidad corporativa (rojo #b32025, gris #222), menú con desplegables, sin jQuery ni fuentes externas. Pensado para el contenido del rediseño 2026 (clases .hg-*).
Version: 1.0.0
Requires at least: 6.2
Requires PHP: 7.4
License: Propietaria
Text Domain: hg-tecnicos
*/

/* ---------- Base ---------- */
*,*::before,*::after{box-sizing:border-box}
html{-webkit-text-size-adjust:100%;scroll-padding-top:90px}
body{margin:0;background:#fff;color:var(--hg-ink);font-family:var(--hg-font);font-size:1.0625rem;line-height:1.65;-webkit-font-smoothing:antialiased}
body.hg-noscroll{overflow:hidden}
img{max-width:100%;height:auto}
a{color:var(--hg-red)}
.hg-skip{position:absolute;left:-9999px;top:0;background:#fff;padding:10px 14px;z-index:999}
.hg-skip:focus{left:10px;top:10px}
.screen-reader-text{position:absolute!important;clip:rect(1px,1px,1px,1px);width:1px;height:1px;overflow:hidden}
:focus-visible{outline:3px solid var(--hg-red);outline-offset:2px}

/* ---------- Barra superior ---------- */
.hg-topbar{background:var(--hg-ink);color:#c9cbd0;font-size:.82rem}
.hg-topbar .hg-wrap{display:flex;justify-content:space-between;gap:16px;min-height:34px;align-items:center}
.hg-topbar a{color:#fff;text-decoration:none;margin-left:18px}
.hg-topbar a:hover{color:#f6dadb}
@media(max-width:760px){.hg-topbar span:first-child{display:none}.hg-topbar .hg-wrap{justify-content:center}.hg-topbar a{margin:0 9px}}

/* ---------- Cabecera ---------- */
.hg-header{position:sticky;top:0;z-index:100;background:#fff;border-bottom:1px solid var(--hg-line)}
.admin-bar .hg-header{top:32px}
@media(max-width:782px){.admin-bar .hg-header{top:46px}}
.hg-header-in{display:flex;align-items:center;justify-content:space-between;gap:20px;min-height:70px}
.hg-logo{display:flex;align-items:center;gap:10px;text-decoration:none;color:var(--hg-ink);font-weight:700;line-height:1.15;flex:none}
.hg-logo b{display:inline-grid;place-items:center;width:42px;height:42px;background:var(--hg-red);color:#fff;border-radius:4px;font-size:16px;letter-spacing:.02em}
.hg-logo small{display:block;font-weight:400;font-size:.7rem;color:var(--hg-mute);letter-spacing:.1em;text-transform:uppercase;margin-top:2px}
.custom-logo-link img{max-height:52px;width:auto;display:block}

/* ---------- Menú escritorio ---------- */
.hg-menu{list-style:none;margin:0;padding:0;display:flex;align-items:center;gap:2px}
.hg-menu>li{position:relative}
.hg-menu a{display:block;color:var(--hg-ink);text-decoration:none;font-size:.95rem;padding:10px 11px;border-radius:4px;white-space:nowrap}
.hg-menu>li>a:hover,.hg-menu>li.current-menu-item>a,.hg-menu>li.current-menu-ancestor>a,.hg-menu>li.current-menu-parent>a{color:var(--hg-red);background:var(--hg-soft)}
.hg-menu>.menu-item-has-children>a::after{content:"";display:inline-block;width:6px;height:6px;margin-left:7px;border-right:2px solid currentColor;border-bottom:2px solid currentColor;transform:translateY(-3px) rotate(45deg);opacity:.7}
.hg-menu .sub-menu{list-style:none;margin:0;padding:8px;position:absolute;left:0;top:100%;min-width:260px;background:#fff;border:1px solid var(--hg-line);border-top:3px solid var(--hg-red);border-radius:0 0 6px 6px;box-shadow:0 14px 34px rgba(34,34,34,.12);opacity:0;visibility:hidden;transform:translateY(6px);transition:opacity .15s,transform .15s,visibility .15s}
.hg-menu li:hover>.sub-menu,.hg-menu li:focus-within>.sub-menu{opacity:1;visibility:visible;transform:none}
.hg-menu .sub-menu a{font-size:.92rem;padding:8px 12px}
.hg-menu .sub-menu a:hover,.hg-menu .sub-menu .current-menu-item>a{background:var(--hg-soft);color:var(--hg-red)}
.hg-menu .sub-menu li:last-child a[href$="/servicios/"]{border-top:1px solid var(--hg-line);margin-top:4px;font-weight:700;color:var(--hg-red)}
.hg-menu>.hg-nav-cta>a{background:var(--hg-red);color:#fff!important;font-weight:700;padding:10px 16px;margin-left:8px}
.hg-menu>.hg-nav-cta>a:hover{background:var(--hg-red-dk)}
.hg-sub-toggle{display:none}
.hg-burger{display:none}

@media(max-width:1180px){.hg-menu a{padding:10px 8px;font-size:.9rem}}

/* ---------- Menú móvil ---------- */
@media(max-width:1060px){
  .hg-burger{display:inline-grid;place-items:center;width:46px;height:46px;border:1px solid var(--hg-line);border-radius:6px;background:#fff;cursor:pointer}
  .hg-burger span,.hg-burger span::before,.hg-burger span::after{display:block;width:22px;height:2px;background:var(--hg-ink);position:relative;transition:transform .2s,background .2s}
  .hg-burger span::before,.hg-burger span::after{content:"";position:absolute;left:0}
  .hg-burger span::before{top:-7px}.hg-burger span::after{top:7px}
  .hg-burger[aria-expanded="true"] span{background:transparent}
  .hg-burger[aria-expanded="true"] span::before{transform:translateY(7px) rotate(45deg)}
  .hg-burger[aria-expanded="true"] span::after{transform:translateY(-7px) rotate(-45deg)}
  .hg-nav{display:none;position:absolute;left:0;right:0;top:100%;height:calc(100vh - 70px);height:calc(100dvh - 70px);background:#fff;overflow-y:auto;overscroll-behavior:contain;border-top:1px solid var(--hg-line);padding:10px 20px 72px;box-shadow:0 20px 30px rgba(0,0,0,.08)}
  .hg-nav.is-open{display:block}
  .hg-menu{flex-direction:column;align-items:stretch;gap:0}
  .hg-menu>li{border-bottom:1px solid var(--hg-line);display:flex;flex-wrap:wrap;align-items:center}
  .hg-menu>li>a{flex:1;padding:14px 4px;font-size:1.02rem}
  .hg-menu>li:not(.hg-nav-cta)>a{background:none!important}
  .hg-menu>.menu-item-has-children>a::after{display:none}
  .hg-sub-toggle{display:block;width:46px;height:46px;border:0;background:none;cursor:pointer;position:relative}
  .hg-sub-toggle::after{content:"";position:absolute;left:18px;top:16px;width:9px;height:9px;border-right:2px solid var(--hg-red);border-bottom:2px solid var(--hg-red);transform:rotate(45deg);transition:transform .2s}
  .is-open>.hg-sub-toggle::after{transform:translateY(5px) rotate(-135deg)}
  .hg-menu .sub-menu{position:static;flex-basis:100%;min-width:0;opacity:1;visibility:visible;transform:none;box-shadow:none;border:0;border-left:3px solid var(--hg-red);border-radius:0;margin:0 0 12px 4px;padding:0 0 0 10px;display:none;transition:none}
  .hg-menu li.is-open>.sub-menu{display:block}
  .hg-menu .sub-menu a{padding:10px 8px;white-space:normal}
  .hg-menu>.hg-nav-cta{border:0;margin-top:16px}
  .hg-menu>.hg-nav-cta>a{margin:0;text-align:center;padding:14px}
}

/* ---------- Cabecera reducida (blog, legales) ---------- */
.hg-hero--sm{padding:clamp(36px,6vw,64px) 0 clamp(30px,5vw,48px)}
.hg-hero--sm h1{max-width:28ch;font-size:clamp(1.7rem,3.6vw,2.5rem)}
.hg-hero--sm::after{width:240px;height:240px;border-width:40px}
.hg-meta{color:#c9cbd0;font-size:.92rem;margin:0}

/* ---------- Contenido editorial ---------- */
.hg-entry{max-width:780px;padding:clamp(32px,5vw,56px) 0;font-size:1.0625rem}
.hg-entry h2{font-size:1.5rem;margin:1.8em 0 .6em}
.hg-entry h3{font-size:1.2rem;margin:1.5em 0 .5em}
.hg-entry p,.hg-entry ul,.hg-entry ol{margin:0 0 1.1em}
.hg-entry table{width:100%;border-collapse:collapse;margin:1.2em 0}
.hg-entry th{background:var(--hg-red);color:#fff;text-align:left;padding:9px 11px}
.hg-entry td{border-bottom:1px solid var(--hg-line);padding:9px 11px}
.hg-entry blockquote{border-left:4px solid var(--hg-red);margin:1.4em 0;padding:.2em 0 .2em 1.2em;color:#444}
.hg-entry figure{margin:1.6em 0}
.hg-entry figcaption{font-size:.85rem;color:var(--hg-mute);margin-top:.5em}
.hg-entry-thumb img{border-radius:6px;width:100%}
.hg-entry--post .hg{font-size:inherit}
.hg-related{padding:0 0 clamp(40px,6vw,72px);border-top:1px solid var(--hg-line);padding-top:36px}
.hg-related h2{font-size:1.35rem}

/* ---------- Tarjetas de entradas y paginación ---------- */
.hg-pcard-img{display:block;margin:-22px -22px 16px;overflow:hidden;border-radius:4px 4px 0 0}
.hg-pcard-img img{display:block;width:100%;aspect-ratio:16/10;object-fit:cover}
.hg-pcard h3 a{color:var(--hg-ink);text-decoration:none}
.hg-pcard h3 a:hover{color:var(--hg-red)}
.hg-pager{margin-top:36px}
.hg-pager .nav-links{display:flex;flex-wrap:wrap;gap:6px}
.hg-pager .page-numbers{display:inline-block;padding:8px 14px;border:1px solid var(--hg-line);border-radius:4px;text-decoration:none;color:var(--hg-ink)}
.hg-pager .page-numbers.current,.hg-pager .page-numbers:hover{background:var(--hg-red);border-color:var(--hg-red);color:#fff}
.search-form{display:flex;gap:8px;max-width:480px}
.search-form input[type=search]{flex:1;padding:12px;border:1px solid var(--hg-line);border-radius:6px;font-size:16px}
.search-form input[type=submit]{padding:12px 18px;border:0;border-radius:6px;background:var(--hg-red);color:#fff;font-weight:700;cursor:pointer}

/* ---------- Pie ---------- */
.hg-footer{background:var(--hg-ink);color:#bbb;font-size:.95rem;padding:56px 0 24px}
.hg-fgrid{display:grid;gap:32px;grid-template-columns:repeat(auto-fit,minmax(210px,1fr))}
.hg-fh{color:#fff;font-weight:700;font-size:.82rem;letter-spacing:.12em;text-transform:uppercase;margin:0 0 14px;padding-bottom:6px;border-bottom:2px solid var(--hg-red);display:inline-block}
.hg-footer p{margin:0 0 1em}
.hg-fmenu,.hg-lmenu{list-style:none;margin:0;padding:0}
.hg-fmenu li{margin:6px 0}
.hg-footer a{color:#ddd;text-decoration:none}
.hg-footer a:hover{color:#fff;text-decoration:underline}
.hg-flegal{border-top:1px solid #3a3a3a;margin-top:40px;padding-top:18px;font-size:.84rem;display:flex;flex-wrap:wrap;gap:12px 24px;justify-content:space-between;align-items:center}
.hg-lmenu{display:flex;flex-wrap:wrap;gap:6px 18px}

/* ---------- Bloques de WordPress básicos ---------- */
.alignwide{max-width:1140px;margin-left:auto;margin-right:auto}
.alignfull{width:100%}
.aligncenter{margin-left:auto;margin-right:auto;display:block}
.wp-block-image img{height:auto}
