/*
Theme Name: Maglietta SEO Theme
Theme URI: https://magliettadisicurezza.it/
Author: Based Digitale
Description: Lightweight SEO-oriented theme with hero, breadcrumbs, responsive nav, and structured data.
Version: 1.1.12
License: GPLv2 or later
Text Domain: maglietta-seo-theme
*/

:root {
  --container: 820px;
  --bg: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --border: rgba(17,24,39,.10);
  --pill: rgba(17,24,39,.06);
  --pillHover: rgba(17,24,39,.10);
  --shadow: 0 10px 30px rgba(17,24,39,.06);
  --font-body: Inter, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.6;
}
a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; }

.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 18px;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 999;
  background: rgba(255,255,255,.90);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.header-top-image {
  border-bottom: 1px solid var(--border);
}
.header-top-image .container {
  padding-top: 10px;
  padding-bottom: 10px;
  display: flex;
  justify-content: center;
}
/* Requested: max 80px height, preserve ratio */
.header-top-image img {
  max-height: 80px;
  width: auto;
  max-width: 100%;
  height: auto;
  display: block;
  object-fit: contain;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.brand img {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  object-fit: contain;
}
.brand .title {
  font-weight: 700;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-wrap { display: flex; align-items: center; gap: 10px; }

.hamburger {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 14px;
  cursor: pointer;
}

.primary-nav { position: relative; }

.primary-nav .menu {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  /* Desktop: allow dropdowns to escape the nav bar (avoid overflow clipping) */
  flex-wrap: wrap;
  white-space: normal;
  overflow: visible;
  -webkit-overflow-scrolling: auto;
  scrollbar-width: none;
}
.primary-nav .menu::-webkit-scrollbar { display: none; }

.primary-nav .menu > li {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
}

.primary-nav .menu > li > a {
  display: inline-flex;
  align-items: center;
  padding: 10px 13px;
  border-radius: 999px;
  background: var(--pill);
  border: 1px solid var(--border);
  font-weight: 650;
  font-size: 14px;
  line-height: 1;
}
.primary-nav .menu > li > a:hover { background: var(--pillHover); text-decoration: none; }

.nav-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
  cursor: pointer;
}
.nav-toggle:hover { background: var(--pillHover); }
.nav-toggle svg { width: 14px; height: 14px; }

.sub-menu {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  min-width: 240px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 8px;
  margin: 0;
  list-style: none;
  display: none;
  z-index: 2000;
}
.sub-menu li a {
  display: block;
  padding: 10px 12px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 14px;
}
.sub-menu li a:hover { background: var(--pill); text-decoration: none; }
li.is-open > .sub-menu { display: block; }

.hero { padding: 28px 0 10px; }
.hero-card {
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 18px 18px 16px;
  background: #fff;
}

/* Optional square hero image (used when hero-card is disabled on a page) */
.hero-square {
  width: 240px;
  max-width: 100%;
  aspect-ratio: 1 / 1;
  border: 1px solid var(--border);
  border-radius: 18px;
  overflow: hidden;
  background: #fff;
  box-shadow: var(--shadow);
}
.hero-square-img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}
.breadcrumbs { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.breadcrumbs a { color: var(--muted); }
.hero h1 { margin: 10px 0 6px; line-height: 1.15; letter-spacing: -0.03em; font-size: 30px; }
.hero .desc { margin: 0; color: var(--muted); font-size: 15px; }

main { padding: 16px 0 44px; }
.content-card { border: 1px solid var(--border); border-radius: 18px; padding: 18px; background: #fff; }

.site-footer { border-top: 1px solid var(--border); padding: 18px 0; color: var(--muted); font-size: 13px; }

@media (max-width: 780px) {
  :root { --container: 620px; }
  .hamburger { display: inline-flex; }
  .primary-nav {
    position: fixed;
    inset: 70px 12px auto 12px;
    max-width: var(--container);
    margin: 0 auto;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: var(--shadow);
    padding: 10px;
    display: none;
  }
  .primary-nav.is-open { display: block; }
  .primary-nav .menu {
    overflow: visible;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .primary-nav .menu > li { justify-content: space-between; flex-wrap: wrap; }
  .primary-nav .menu > li > a { width: calc(100% - 44px); justify-content: flex-start; }
  .nav-toggle { width: 40px; height: 40px; }
  .sub-menu {
    position: static;
    display: none;
    box-shadow: none;
    border-radius: 14px;
    margin-top: 8px;
  }
  li.is-open > .sub-menu { display: block; }
}

@media (max-width: 420px) {
  .hero-square { width: 100%; }
}


/* === MENU FIX v1.1.1: make submenu toggle always clickable === */
.primary-nav .menu > li { position: relative; }
.primary-nav .menu > li > a { position: relative; z-index: 1; padding-right: 52px; } /* room for toggle */
.primary-nav .menu > li > button.nav-toggle{
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 5;
  pointer-events: auto;
}
/* If any optimizer injects overlays on links, ensure toggle stays on top */
.primary-nav .menu > li > a, .primary-nav .menu > li > a * { pointer-events: auto; }
.primary-nav .menu > li > button.nav-toggle, .primary-nav .menu > li > button.nav-toggle * { pointer-events: auto; }

/* Submenu visibility is controlled only by .is-open */
.primary-nav .menu > li > ul.sub-menu { display: none; }
.primary-nav .menu > li.is-open > ul.sub-menu { display: block; }


/* === SUBMENU FALLBACK (no-JS): open on hover and on focus-within (click) === */
@media (min-width: 781px){
  .primary-nav .menu > li:hover > ul.sub-menu,
  .primary-nav .menu > li:focus-within > ul.sub-menu{
    display:block !important;
  }
}

/* === Footer custom HTML (Customizer) === */
.footer-custom-html{
  margin-top: 12px;
  max-width: 100%;
  overflow: hidden;
}
.header-top-image-link img{ display:block; }
