/*
Theme Name: Megah
Theme URI: https://www.megahtelecomunicazioni.it/
Author: Megah Telecomunicazioni S.r.l.
Description: Tema a blocchi su misura per Megah Telecomunicazioni.
Version: 1.0.0
Requires at least: 6.6
Requires PHP: 7.4
License: GNU General Public License v2 or later
Text Domain: megah
*/

/* ---------- Base ---------- */
:root { --megah-surface: #fff; --megah-field: #fff; }
html { scroll-behavior: smooth; }
body { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
:where(a, button, summary, input, select, textarea):focus-visible { outline: 2px solid var(--wp--preset--color--accent); outline-offset: 3px; border-radius: 4px; }
::selection { background: var(--wp--preset--color--primary); color: #fff; }
.screen-reader-text:focus { clip: auto !important; clip-path: none; height: auto; width: auto; z-index: 100000; background: #fff; padding: .75rem 1rem; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } *, *::before, *::after { transition: none !important; animation: none !important; } }

/* ---------- Header ---------- */
.megah-site-header { position: sticky; top: var(--wp-admin--admin-bar--height, 0px); z-index: 50; }
.megah-topbar a { color: inherit; text-decoration: none; }
.megah-topbar a:hover { color: #fff; text-decoration: underline; }
.megah-topbar img { width: 14px; height: 14px; vertical-align: -2px; margin-right: .4rem; filter: brightness(0) invert(1); opacity: .7; }
@media (max-width: 781px) { .megah-topbar { display: none !important; } }
/* niente backdrop-filter: renderebbe l'header contenitore del menu mobile (position: fixed) */
.megah-header .wp-block-image img { display: block; }
.megah-header .wp-block-navigation-item__content { padding: .5rem .25rem; }
.megah-header .wp-block-navigation-item__content:hover,
.megah-header .current-menu-item > .wp-block-navigation-item__content { color: var(--wp--preset--color--primary); }
.megah-header .wp-block-navigation__submenu-container { border: 1px solid var(--wp--preset--color--line) !important; border-radius: 14px; box-shadow: var(--wp--preset--shadow--md); padding: .5rem !important; min-width: 230px !important; }
.megah-header .wp-block-navigation__submenu-container .wp-block-navigation-item__content { padding: .55rem .75rem !important; border-radius: 8px; }
.megah-header .wp-block-navigation__submenu-container .wp-block-navigation-item__content:hover { background: var(--wp--preset--color--teal-50); }
/* Menu mobile/tablet aperto: a tutto schermo, allineato a sinistra, sottomenu inline */
.megah-header .is-menu-open { padding: 1.5rem clamp(1rem, 4vw, 2rem) !important; }
.megah-header .is-menu-open :is(.wp-block-navigation__responsive-container-content, .wp-block-navigation__container, .wp-block-navigation-item) { align-items: flex-start !important; text-align: left; }
.megah-header .is-menu-open .wp-block-navigation__container { gap: .35rem !important; width: 100%; }
.megah-header .is-menu-open .wp-block-navigation-item { font-size: 1.25rem; font-family: var(--wp--preset--font-family--display); font-weight: 600; width: 100%; }
.megah-header .is-menu-open .wp-block-navigation__submenu-container { border: 0 !important; box-shadow: none !important; padding: .25rem 0 .5rem 1rem !important; min-width: 0 !important; }
.megah-header .is-menu-open .wp-block-navigation__submenu-container .wp-block-navigation-item { font-size: 1.0625rem; font-family: var(--wp--preset--font-family--body); font-weight: 500; }
.megah-header .is-menu-open .wp-block-navigation__submenu-icon { display: none; }
.megah-header .wp-block-image { flex-shrink: 0; }
.megah-header-cta .wp-block-button__link { white-space: nowrap; }
/* 7 voci + CTA non stanno in una riga sotto i 1100px: hamburger anche su tablet */
@media (min-width: 600px) and (max-width: 1099px) {
	.megah-header .wp-block-navigation__responsive-container-open:not(.always-shown) { display: flex; }
	.megah-header .wp-block-navigation__responsive-container:not(.hidden-by-default):not(.is-menu-open) { display: none; }
}
@media (max-width: 599px) { .megah-header .megah-header-cta { display: none; } }

/* ---------- Typography helpers ---------- */
.megah-eyebrow { display: inline-flex; align-items: center; gap: .75rem; text-transform: uppercase; letter-spacing: .14em; font-size: var(--wp--preset--font-size--xs); font-weight: 600; color: var(--wp--preset--color--primary); }
.megah-eyebrow::before { content: ""; width: 28px; height: 2px; background: var(--wp--preset--color--accent); flex: none; }
.megah-lead { font-size: var(--wp--preset--font-size--lg); color: var(--wp--preset--color--slate); }
.megah-hero .megah-lead { color: var(--wp--preset--color--teal-100); }
.has-teal-950-background-color, .has-teal-900-background-color { color: var(--wp--preset--color--teal-100); }
:is(.has-teal-950-background-color, .has-teal-900-background-color, .megah-hero) :is(h1, h2, h3, h4) { color: #fff; }
:is(.has-teal-950-background-color, .has-teal-900-background-color) a:not(.wp-block-button__link) { color: #fff; }
.has-teal-950-background-color .megah-eyebrow,
.megah-hero .megah-eyebrow { color: var(--wp--preset--color--teal-200); }

/* ---------- Hero ---------- */
.megah-hero { position: relative; overflow: hidden; isolation: isolate; }
.megah-hero::after { /* richiamo grafico del marchio: banda rossa diagonale */
	content: ""; position: absolute; z-index: -1; right: -6%; top: -30%; width: 46%; height: 160%;
	background: linear-gradient(135deg, transparent 47%, rgba(200,16,46,.22) 47%, rgba(200,16,46,.22) 53%, transparent 53%),
		linear-gradient(135deg, transparent 60%, rgba(255,255,255,.05) 60%, rgba(255,255,255,.05) 70%, transparent 70%);
	pointer-events: none;
}
.megah-hero a:not(.wp-block-button__link) { color: #fff; }
.megah-hero .wp-block-post-excerpt__excerpt { margin: 0; }

/* ---------- Buttons ---------- */
.wp-block-button__link { transition: background-color .2s, color .2s, box-shadow .2s, transform .2s; }
.wp-block-button__link:hover { transform: translateY(-1px); }
.wp-block-button.is-style-outline > .wp-block-button__link { border: 1.5px solid currentColor; background: transparent; color: var(--wp--preset--color--primary); }
.wp-block-button.is-style-outline > .wp-block-button__link:hover { background: var(--wp--preset--color--teal-50); color: var(--wp--preset--color--teal-800); }
.megah-hero .wp-block-button.is-style-outline > .wp-block-button__link,
.has-teal-950-background-color .wp-block-button.is-style-outline > .wp-block-button__link,
.has-teal-900-background-color .wp-block-button.is-style-outline > .wp-block-button__link { color: #fff; }
.megah-hero .wp-block-button.is-style-outline > .wp-block-button__link:hover,
.has-teal-950-background-color .wp-block-button.is-style-outline > .wp-block-button__link:hover,
.has-teal-900-background-color .wp-block-button.is-style-outline > .wp-block-button__link:hover { background: rgba(255,255,255,.1); color: #fff; }

/* ---------- Cards ---------- */
.megah-card { background: var(--megah-surface); border: 1px solid var(--wp--preset--color--line); border-radius: 22px; box-shadow: var(--wp--preset--shadow--sm); transition: box-shadow .25s, transform .25s, border-color .25s; height: 100%; }
.megah-card:hover { box-shadow: var(--wp--preset--shadow--md); border-color: var(--wp--preset--color--teal-200); }
.megah-card--link { position: relative; }
.megah-card--link:hover { transform: translateY(-3px); }
.megah-card--link h3 a::after { content: ""; position: absolute; inset: 0; border-radius: inherit; } /* intera card cliccabile */
.megah-card--link h3 a { color: inherit; text-decoration: none; }
.megah-card .megah-more { margin-top: auto; font-weight: 600; font-size: var(--wp--preset--font-size--sm); color: var(--wp--preset--color--primary); }
.megah-card .megah-more::after { content: " →"; }
.wp-block-columns .megah-card { display: flex; flex-direction: column; }

/* ---------- Icon tile ---------- */
.megah-icon { margin: 0 !important; flex-shrink: 0; }
.megah-icon img { width: 52px; height: 52px; padding: 13px; border-radius: 14px; background: var(--wp--preset--color--teal-50); box-sizing: border-box; }
.megah-icon--lg img { width: 64px; height: 64px; padding: 16px; }

/* ---------- Check list ---------- */
.megah-checks { list-style: none; padding-left: 0 !important; display: grid; gap: .65rem 2rem; }
@media (min-width: 700px) { .megah-checks.is-2col { grid-template-columns: 1fr 1fr; } }
.megah-checks li { position: relative; padding-left: 2rem; }
.megah-checks li::before { content: ""; position: absolute; left: 0; top: .2em; width: 1.25rem; height: 1.25rem; border-radius: 50%;
	background: var(--wp--preset--color--teal-100) url("assets/icons/check.svg") center / 70% no-repeat; }

/* ---------- Logos ---------- */
.megah-logos { display: grid !important; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 1rem !important; align-items: stretch; }
.megah-logos figure { margin: 0 !important; display: grid; place-items: center; background: #fff; border: 1px solid var(--wp--preset--color--line); border-radius: 14px; padding: 1.25rem 1rem; min-height: 88px; }
.megah-logos img { max-height: 40px; width: auto !important; max-width: 100%; object-fit: contain; filter: grayscale(1); opacity: .75; transition: filter .25s, opacity .25s; }
.megah-logos figure:hover img { filter: none; opacity: 1; }

/* ---------- Stats ---------- */
.megah-stat-num { font-family: var(--wp--preset--font-family--display); font-weight: 700; font-size: clamp(2.25rem, 5vw, 3.25rem); line-height: 1; letter-spacing: -.03em; color: var(--wp--preset--color--primary); margin: 0 !important; }
.has-teal-950-background-color .megah-stat-num { color: #fff; }

/* ---------- FAQ (blocco Dettagli) ---------- */
.wp-block-details summary { cursor: pointer; list-style: none; font-family: var(--wp--preset--font-family--display); font-weight: 600; font-size: var(--wp--preset--font-size--lg); color: var(--wp--preset--color--ink); padding-right: 2.5rem; position: relative; }
.wp-block-details summary::-webkit-details-marker { display: none; }
.wp-block-details summary::after { content: "+"; position: absolute; right: .25rem; top: 50%; transform: translateY(-50%); font-size: 1.5rem; font-weight: 400; color: var(--wp--preset--color--primary); transition: transform .2s; }
.wp-block-details[open] summary::after { transform: translateY(-50%) rotate(45deg); }
.wp-block-details > :not(summary) { margin-top: .75rem; color: var(--wp--preset--color--slate); }

/* ---------- Media ---------- */
.megah-rounded img { border-radius: 22px; }
.megah-cert img { width: 100%; aspect-ratio: 4 / 3; object-fit: contain; padding: .75rem; box-sizing: border-box; border-radius: 14px; border: 1px solid var(--wp--preset--color--line); box-shadow: var(--wp--preset--shadow--sm); background: #fff; }

/* ---------- News ---------- */
.megah-news .wp-block-post { height: 100%; }
.megah-news .wp-block-post-date { color: var(--wp--preset--color--slate); font-size: var(--wp--preset--font-size--xs); text-transform: uppercase; letter-spacing: .08em; }

/* ---------- Form (Contact Form 7) ---------- */
.wpcf7-form { display: grid; gap: 1.1rem; }
.wpcf7-form p { margin: 0; }
.wpcf7-form br { display: none; }
.wpcf7-form .wpcf7-not-valid-tip { font-size: var(--wp--preset--font-size--xs); color: var(--wp--preset--color--accent); margin-top: .35rem; font-weight: 500; }
.wpcf7-form .wpcf7-not-valid { border-color: var(--wp--preset--color--accent) !important; }
.wpcf7 form .wpcf7-response-output { margin: 0; border-radius: 10px; padding: .85rem 1rem; font-size: var(--wp--preset--font-size--sm); }
.wpcf7-form label { display: block; font-weight: 600; font-size: var(--wp--preset--font-size--sm); color: var(--wp--preset--color--ink); }
.wpcf7-form .wpcf7-form-control-wrap { display: block; margin-top: .4rem; }
.wpcf7-form input:not([type=checkbox]):not([type=submit]), .wpcf7-form select, .wpcf7-form textarea {
	width: 100%; box-sizing: border-box; font: inherit; font-size: 1rem; color: var(--wp--preset--color--ink); background: var(--megah-field);
	border: 1.5px solid var(--wp--preset--color--line); border-radius: 10px; padding: .8rem 1rem; transition: border-color .2s, box-shadow .2s; }
.wpcf7-form input:focus, .wpcf7-form select:focus, .wpcf7-form textarea:focus { outline: none; border-color: var(--wp--preset--color--primary); box-shadow: 0 0 0 4px var(--wp--preset--color--teal-100); }
.wpcf7-form textarea { min-height: 150px; resize: vertical; }
.wpcf7-form .wpcf7-acceptance label { font-weight: 400; color: var(--wp--preset--color--slate); }
.wpcf7-form .wpcf7-list-item { margin: 0; }
.wpcf7-form input[type=checkbox] { width: 1.15rem; height: 1.15rem; accent-color: var(--wp--preset--color--primary); vertical-align: -3px; margin-right: .5rem; }
.wpcf7-form input[type=submit] { justify-self: start; font: inherit; font-weight: 600; font-size: var(--wp--preset--font-size--sm); color: #fff; background: var(--wp--preset--color--accent); border: 0; border-radius: 999px; padding: .95rem 1.75rem; cursor: pointer; transition: background-color .2s; }
.wpcf7-form input[type=submit]:hover { background: var(--wp--preset--color--accent-dark); }
.wpcf7-form input[type=submit]:disabled { opacity: .5; cursor: not-allowed; }
@media (min-width: 700px) { .wpcf7-form .megah-form-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 1.1rem; } }

/* ---------- Footer ---------- */
.megah-footer a { color: rgba(255,255,255,.82); text-decoration: none; }
.megah-footer a:hover { color: #fff; text-decoration: underline; }
.megah-footer .megah-footer-links { list-style: none; padding: 0 !important; display: grid; gap: .5rem; }
.megah-footer h2 { color: #fff; }
.megah-footer .wp-block-button.is-style-outline > .wp-block-button__link { color: #fff; }
.megah-footer .wp-block-button.is-style-outline > .wp-block-button__link:hover { background: rgba(255,255,255,.1); }

/* ---------- Home: box "Come possiamo aiutarti?" ---------- */
.megah-quick { border-radius: 22px; box-shadow: var(--wp--preset--shadow--lg); }
.megah-quick-row { border-radius: 14px; transition: background-color .2s; }
.megah-quick-row:hover { background: var(--wp--preset--color--teal-50); }
.megah-hero .megah-quick .megah-eyebrow { color: var(--wp--preset--color--primary); }
.megah-hero .megah-quick :is(h2, h3, h4), .megah-hero .megah-quick a:not(.wp-block-button__link) { color: var(--wp--preset--color--ink); }
.megah-quick-row h2 a { text-decoration: none; }
.megah-quick-row h2 a::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.megah-quick-row { position: relative; }

/* Sezioni a filo: niente spazio tra header, contenuto e footer */
.wp-site-blocks > * + * { margin-block-start: 0; }
[id] { scroll-margin-top: 130px; }
.megah-product img { background: #fff; border: 1px solid var(--wp--preset--color--line); border-radius: 14px; padding: 1rem; box-sizing: border-box; width: 100%; aspect-ratio: 4 / 3; object-fit: contain; }
.megah-brand h3 { margin-top: var(--wp--preset--spacing--40); }
.megah-cert figcaption { text-align: center; font-size: var(--wp--preset--font-size--sm); color: var(--wp--preset--color--slate); }
.megah-header .wp-block-image img, .megah-footer .wp-block-image img { aspect-ratio: 1122 / 307; } /* niente salto di layout prima del caricamento SVG */
.megah-btn-download .wp-block-button__link::before { content: ""; display: inline-block; width: 1em; height: 1em; margin-right: .45em; vertical-align: -.15em; background: currentColor; -webkit-mask: url("assets/icons/download.svg") center / contain no-repeat; mask: url("assets/icons/download.svg") center / contain no-repeat; }
.megah-partner-logo { height: 88px; display: flex; align-items: center; margin: 0 !important; }
.megah-partner-logo img { max-height: 88px; max-width: min(100%, 220px); width: auto; height: auto; }
.megah-badge { align-self: flex-start; background: var(--wp--preset--color--teal-50); color: var(--wp--preset--color--primary); border: 1px solid var(--wp--preset--color--teal-100); border-radius: 999px; padding: .2rem .75rem; font-size: var(--wp--preset--font-size--xs); font-weight: 600; letter-spacing: .02em; }
.megah-logos.is-few { grid-template-columns: repeat(auto-fill, minmax(130px, 190px)); }
.megah-fonti { margin-top: var(--wp--preset--spacing--40) !important; padding-top: 1rem; border-top: 1px solid var(--wp--preset--color--line); font-size: var(--wp--preset--font-size--xs); color: var(--wp--preset--color--slate); }

/* ---------- Barra contatti fissa (solo smartphone e tablet) ---------- */
.megah-mobilebar { display: none !important; }
@media (max-width: 781px) {
	body { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
	.megah-mobilebar { display: flex !important; position: fixed; z-index: 40; /* sotto l’header (50), che contiene il menu aperto */ left: 0; right: 0; bottom: 0; gap: 0 !important; margin: 0 !important;
		background: var(--megah-surface); border-top: 1px solid var(--wp--preset--color--line); box-shadow: 0 -6px 20px rgba(8,63,75,.08); padding-bottom: env(safe-area-inset-bottom); }
	.megah-mobilebar p { flex: 1; margin: 0 !important; }
	.megah-mobilebar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .2rem; height: 64px; font-size: .75rem; font-weight: 600; text-decoration: none; color: var(--wp--preset--color--teal-800); }
	.megah-mobilebar img { width: 22px; height: 22px; }
	.megah-mobilebar .is-primary a { background: var(--wp--preset--color--accent); color: #fff; }
	.megah-mobilebar .is-primary img { filter: brightness(0) invert(1); }
}

/* ---------- Contratti: formule ---------- */
.megah-plan .wp-block-buttons { margin-top: auto; }
.megah-plan.is-featured { border: 2px solid var(--wp--preset--color--primary); box-shadow: var(--wp--preset--shadow--md); }
#contratti > h3 { margin-top: var(--wp--preset--spacing--50); }
