/*
Theme Name: RB S.r.l.
Theme URI: https://rbsrl.org/
Author: RB S.r.l.
Description: Tema a blocchi per rbsrl.org: grafica tech scura, animazioni leggere in JavaScript puro (nessuna libreria), font e immagini inclusi nel tema. Niente page builder, niente jQuery.
Requires at least: 6.6
Tested up to: 7.1
Requires PHP: 7.4
Version: 2.0.0
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: rb-srl
*/

:root {
	--rb-ease: cubic-bezier(.2, .75, .2, 1);
	--rb-glass: rgba(12, 19, 42, .55);
	--rb-border: rgba(255, 255, 255, .09);
	--rb-grad: linear-gradient(100deg, #ffffff 0%, #b9c8ff 40%, #22d3ee 100%);
}
@property --rb-a { syntax: "<angle>"; inherits: false; initial-value: 0deg; }

body { -webkit-font-smoothing: antialiased; overflow-x: clip; }
::selection { background: var(--wp--preset--color--electric); color: #fff; }

/* Sfondo: griglia tecnica sfumata e bagliori fissi */
body::before, body::after { content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none; }
body::before {
	background: linear-gradient(rgba(255, 255, 255, .04) 1px, transparent 1px) 0 0 / 72px 72px, linear-gradient(90deg, rgba(255, 255, 255, .04) 1px, transparent 1px) 0 0 / 72px 72px;
	-webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 30%, transparent 80%);
	mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 30%, transparent 80%);
}
body::after { background: radial-gradient(900px 600px at 0% 0%, rgba(61, 107, 255, .16), transparent 60%), radial-gradient(800px 600px at 100% 40%, rgba(34, 211, 238, .08), transparent 60%), radial-gradient(700px 500px at 30% 100%, rgba(255, 138, 61, .06), transparent 60%); }

/* Le sezioni a tutta larghezza sono attaccate tra loro */
.wp-site-blocks > *, .wp-site-blocks > main > * { margin-block-start: 0; }

/* Immagini */
img { max-width: 100%; height: auto; }
.rb-ratio-square img { aspect-ratio: 1 / 1; width: 100%; object-fit: cover; }
.rb-ratio-photo img { aspect-ratio: 3 / 2; width: 100%; object-fit: cover; }

/* ── Header flottante in vetro ─────────────────────────────────────────── */
.wp-site-blocks > header.wp-block-template-part { position: fixed; top: 14px; left: 0; right: 0; z-index: 60; padding: 0 14px; pointer-events: none; }
.admin-bar .wp-site-blocks > header.wp-block-template-part { top: 46px; }
@media (max-width: 782px) { .admin-bar .wp-site-blocks > header.wp-block-template-part { top: 60px; } }
.rb-header {
	pointer-events: auto; max-width: 1240px; margin: 0 auto !important; border-radius: 999px;
	background: var(--rb-glass); border: 1px solid var(--rb-border); box-shadow: 0 18px 40px -24px rgba(0, 0, 0, .8);
	-webkit-backdrop-filter: blur(16px) saturate(170%); backdrop-filter: blur(16px) saturate(170%);
	transition: background .35s ease, box-shadow .35s ease;
}
.rb-scrolled .rb-header { background: rgba(8, 13, 30, .82); box-shadow: 0 18px 50px -20px rgba(61, 107, 255, .35); }
.rb-header .rb-logo img { width: 168px; display: block; }
.rb-header .wp-block-navigation { font-family: var(--wp--preset--font-family--display); }
.rb-header .wp-block-navigation-item__content { padding: .55rem 1rem; border-radius: 999px; font-weight: 500; font-size: .95rem; color: #dfe6ff; transition: background .25s ease, color .25s ease; }
.rb-header .wp-block-navigation-item__content:hover { background: rgba(255, 255, 255, .08); color: #fff; }

/* ── Hero ──────────────────────────────────────────────────────────────── */
.rb-hero { position: relative; min-height: 100vh; min-height: 100svh; display: flex; flex-direction: column; justify-content: center; overflow: hidden; isolation: isolate; padding-top: 130px !important; }
.rb-hero > * { position: relative; z-index: 2; width: 100%; }
.rb-hero > .rb-net { position: absolute; inset: 0; z-index: 0; width: 100%; height: 100%; }
/* pavimento a griglia in prospettiva che scorre */
.rb-hero::before {
	content: ""; position: absolute; z-index: 1; left: -50%; right: -50%; bottom: -14%; height: 42%;
	background: linear-gradient(rgba(61, 107, 255, .5) 1px, transparent 1px) 0 0 / 70px 70px, linear-gradient(90deg, rgba(61, 107, 255, .5) 1px, transparent 1px) 0 0 / 70px 70px;
	transform: perspective(520px) rotateX(64deg); transform-origin: 50% 0;
	-webkit-mask-image: linear-gradient(to bottom, transparent 0%, #000 45%, #000 75%, transparent 100%); mask-image: linear-gradient(to bottom, transparent 0%, #000 45%, #000 75%, transparent 100%);
	animation: rb-floor 5s linear infinite; opacity: .32; pointer-events: none;
}
/* bagliore di orizzonte */
.rb-hero::after { content: ""; position: absolute; z-index: 1; left: 0; right: 0; bottom: 28%; height: 1px; background: linear-gradient(90deg, transparent, rgba(34, 211, 238, .8), transparent); box-shadow: 0 0 40px 8px rgba(61, 107, 255, .35); opacity: .35; pointer-events: none; }
@keyframes rb-floor { to { background-position: 0 70px, 0 0; } }

.rb-hero__title { text-transform: uppercase; line-height: .9 !important; letter-spacing: -.045em !important; margin: 0; }
.rb-plus { color: var(--wp--preset--color--accent); -webkit-text-fill-color: var(--wp--preset--color--accent); font-weight: 400; display: inline-block; text-shadow: 0 0 28px rgba(255, 138, 61, .65); animation: rb-pulse 2.6s ease-in-out infinite; }
.rb-hero__title.is-split .rb-line { display: block; overflow: hidden; padding-bottom: .04em; }
.rb-hero__title.is-split .rb-line > span { display: inline-block; transform: translateY(110%); animation: rb-rise 1s var(--rb-ease) forwards; animation-delay: calc(var(--i) * .13s + .1s); }
.rb-hero__title.is-split .rb-line:last-child > span { background: var(--rb-grad); background-size: 200% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: rb-rise 1s var(--rb-ease) forwards, rb-flow 6s linear infinite; animation-delay: calc(var(--i) * .13s + .1s), 0s; }
@keyframes rb-rise { to { transform: none; } }
@keyframes rb-flow { to { background-position: -200% 0; } }
@keyframes rb-pulse { 50% { opacity: .55; text-shadow: 0 0 10px rgba(255, 138, 61, .3); } }
.rb-hero__lead { color: #c3cff5; max-width: 34ch; }

/* pulsanti */
.wp-block-button__link { position: relative; overflow: hidden; transition: transform .3s var(--rb-ease), box-shadow .3s ease, background .3s ease; }
.wp-block-button:not(.is-style-outline) > .wp-block-button__link { background: linear-gradient(100deg, var(--wp--preset--color--electric), #5b4dff 50%, var(--wp--preset--color--cyan)); background-size: 200% 100%; box-shadow: 0 10px 30px -10px rgba(61, 107, 255, .8), inset 0 1px 0 rgba(255, 255, 255, .25); }
.wp-block-button:not(.is-style-outline) > .wp-block-button__link:hover { background-position: 100% 0; transform: translateY(-2px); box-shadow: 0 18px 40px -12px rgba(34, 211, 238, .7); }
.wp-block-button:not(.is-style-outline) > .wp-block-button__link::after { content: ""; position: absolute; inset: 0; background: linear-gradient(110deg, transparent 35%, rgba(255, 255, 255, .45) 50%, transparent 65%); transform: translateX(-120%); animation: rb-shine 3.8s ease-in-out infinite 1.5s; }
.wp-block-button.is-style-outline > .wp-block-button__link { color: #fff; background: rgba(255, 255, 255, .04); border: 1px solid rgba(255, 255, 255, .22); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.wp-block-button.is-style-outline > .wp-block-button__link:hover { border-color: var(--wp--preset--color--cyan); color: #fff; transform: translateY(-2px); }
@keyframes rb-shine { 0%, 60% { transform: translateX(-120%); } 100% { transform: translateX(120%); } }

/* globo olografico: illustrazione animata senza cornice, si inclina seguendo il mouse */
.rb-hero__visual { position: relative; }
.rb-core { margin: 0 -3% 0 -12%; transform: perspective(1200px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)); transition: transform .6s var(--rb-ease); }
.rb-core img { display: block; width: 100%; aspect-ratio: 3 / 2; filter: drop-shadow(0 30px 80px rgba(61, 107, 255, .45)); }
@keyframes rb-spin { to { --rb-a: 360deg; } }
@keyframes rb-float { 50% { translate: 0 -12px; } }

/* indicatore di scroll (aggiunto dallo script) */
.rb-scrollcue { position: absolute !important; left: 50%; bottom: 26px; width: 24px !important; height: 38px; translate: -50% 0; border: 1.5px solid rgba(255, 255, 255, .35); border-radius: 14px; }
.rb-scrollcue::after { content: ""; position: absolute; left: 50%; top: 7px; width: 3px; height: 7px; translate: -50% 0; border-radius: 2px; background: var(--wp--preset--color--cyan); animation: rb-cue 1.8s ease-in-out infinite; }
@keyframes rb-cue { 0% { opacity: 0; transform: translateY(0); } 30% { opacity: 1; } 100% { opacity: 0; transform: translateY(14px); } }

/* ── Fascia scorrevole ─────────────────────────────────────────────────── */
.rb-marquee { position: relative; overflow: hidden; border-block: 1px solid var(--rb-border); background: linear-gradient(90deg, rgba(61, 107, 255, .08), rgba(34, 211, 238, .05), rgba(255, 138, 61, .06)); }
.rb-marquee::before, .rb-marquee::after { content: ""; position: absolute; top: 0; bottom: 0; width: 12%; z-index: 2; pointer-events: none; }
.rb-marquee::before { left: 0; background: linear-gradient(90deg, var(--wp--preset--color--base), transparent); }
.rb-marquee::after { right: 0; background: linear-gradient(-90deg, var(--wp--preset--color--base), transparent); }
.rb-marquee p { margin: 0; white-space: nowrap; font-family: var(--wp--preset--font-family--display); font-weight: 700; text-transform: uppercase; letter-spacing: -.02em; font-size: clamp(2rem, 5.5vw, 4.6rem); line-height: 1.2; text-align: center; }
.rb-marquee__item { color: transparent; -webkit-text-stroke: 1px rgba(185, 200, 255, .55); }
.rb-marquee__item:nth-child(even) { color: rgba(238, 242, 255, .92); -webkit-text-stroke: 0; }
.rb-marquee__sep { color: var(--wp--preset--color--accent); -webkit-text-stroke: 0; margin: 0 .35em; font-size: .6em; vertical-align: middle; text-shadow: 0 0 20px rgba(255, 138, 61, .7); }
.rb-marquee__inner { display: flex; width: max-content; animation: rb-marquee 40s linear infinite; }
.rb-marquee__inner p { padding-right: .35em; text-align: left; }
.rb-marquee:hover .rb-marquee__inner { animation-play-state: paused; }
@keyframes rb-marquee { to { transform: translateX(-50%); } }

/* ── Titoli di sezione ─────────────────────────────────────────────────── */
.rb-section-title { text-transform: uppercase; background: var(--rb-grad); -webkit-background-clip: text; background-clip: text; color: transparent !important; padding-bottom: .05em; }
.rb-section-title::before { content: ""; display: block; width: 64px; height: 3px; margin-bottom: 1.3rem; border-radius: 2px; background: linear-gradient(90deg, var(--wp--preset--color--accent), var(--wp--preset--color--cyan)); box-shadow: 0 0 18px rgba(34, 211, 238, .6); }

/* ── Servizi: griglia bento ────────────────────────────────────────────── */
.rb-bento { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 18px; counter-reset: rb; }
.rb-bento > .rb-card { margin: 0 !important; }
.rb-bento > :nth-child(1), .rb-bento > :nth-child(4) { grid-column: span 4; }
.rb-bento > :nth-child(2), .rb-bento > :nth-child(3) { grid-column: span 2; }
.rb-card {
	--mx: 50%; --my: 50%;
	position: relative; isolation: isolate; overflow: hidden; counter-increment: rb;
	min-height: clamp(340px, 34vw, 440px); display: flex; flex-direction: column; justify-content: flex-end;
	border-radius: 26px; background: var(--wp--preset--color--surface); border: 1px solid var(--rb-border);
	transform: perspective(1000px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)); transition: transform .45s var(--rb-ease), border-color .3s ease, box-shadow .45s ease;
}
.rb-card > .wp-block-image { position: absolute; inset: 0; z-index: -2; margin: 0; }
.rb-card > .wp-block-image img { width: 100%; height: 100%; aspect-ratio: auto; object-fit: cover; object-position: 50% 30%; transform: scale(1.04); transition: transform 1.1s var(--rb-ease), filter .6s ease; }
.rb-card::before { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(180deg, rgba(5, 7, 15, .05) 0%, rgba(5, 7, 15, .55) 45%, rgba(5, 7, 15, .96) 100%); }
.rb-card::after { content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none; opacity: 0; transition: opacity .35s ease; background: radial-gradient(420px circle at var(--mx) var(--my), rgba(61, 107, 255, .32), transparent 45%); }
.rb-card:hover { border-color: rgba(61, 107, 255, .55); box-shadow: 0 40px 80px -40px rgba(61, 107, 255, .65); }
.rb-card:hover::after { opacity: 1; }
.rb-card:hover > .wp-block-image img { transform: scale(1.1); filter: brightness(1.12) saturate(1.15); }
.rb-card__body { position: relative; z-index: 1; padding: 1.7rem 1.8rem 1.9rem; }
.rb-card__body::before { content: "0" counter(rb); display: block; margin-bottom: .9rem; font-family: var(--wp--preset--font-family--display); font-size: .8rem; font-weight: 600; letter-spacing: .25em; color: var(--wp--preset--color--cyan); }
.rb-card__body h3 { margin: 0 0 .6rem; }
.rb-card__body p { margin: 0; color: #b7c3e6; max-width: 46ch; }

/* ── About: orbita di immagini e testo che si illumina ─────────────────── */
.rb-orbit { --py: 0; position: relative; aspect-ratio: 1 / 1; max-width: 560px; margin-inline: auto; }
.rb-orbit::before { content: ""; position: absolute; inset: 14%; border-radius: 50%; border: 1px dashed rgba(143, 176, 255, .3); animation: rb-orbit 30s linear infinite; }
.rb-orbit::after { content: ""; position: absolute; inset: 27%; border-radius: 50%; padding: 2px; background: conic-gradient(from var(--rb-a), transparent 0deg, var(--wp--preset--color--cyan) 70deg, transparent 140deg, var(--wp--preset--color--electric) 250deg, transparent 320deg); -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; animation: rb-spin 6s linear infinite; filter: drop-shadow(0 0 12px rgba(34, 211, 238, .6)); }
.rb-orbit > .wp-block-image { position: absolute; margin: 0; }
.rb-orbit > .wp-block-image img { border-radius: 22px; box-shadow: 0 30px 60px -25px rgba(0, 0, 0, .9); border: 1px solid var(--rb-border); }
.rb-orbit > :nth-child(1) { inset: 30%; z-index: 2; border-radius: 50%; display: grid; place-items: center; background: radial-gradient(circle at 50% 40%, rgba(61, 107, 255, .35), rgba(11, 18, 38, .95) 70%); box-shadow: 0 0 80px -10px rgba(61, 107, 255, .7), inset 0 0 0 1px rgba(255, 255, 255, .08); }
.rb-orbit > :nth-child(1) img { width: 78%; border: 0; box-shadow: none; border-radius: 0; margin: auto; }
.rb-orbit > :nth-child(2) { top: 0; left: 2%; width: 36%; animation: rb-float 6s ease-in-out infinite; }
.rb-orbit > :nth-child(3) { top: 16%; right: 0; width: 30%; animation: rb-float 7.5s ease-in-out infinite .8s; }
.rb-orbit > :nth-child(4) { bottom: 2%; left: 22%; width: 33%; animation: rb-float 6.8s ease-in-out infinite 1.6s; }
.rb-orbit > :nth-child(2) img { translate: 0 calc(var(--py) * -40px); }
.rb-orbit > :nth-child(3) img { translate: 0 calc(var(--py) * 55px); }
.rb-orbit > :nth-child(4) img { translate: 0 calc(var(--py) * -30px); }
.rb-scrolltext { font-family: var(--wp--preset--font-family--display); font-weight: 500; letter-spacing: -.01em; line-height: 1.45 !important; }
.rb-scrolltext.is-split > span { color: rgba(238, 242, 255, .2); transition: color .4s ease; }
.rb-scrolltext.is-split > span.on { color: #eef2ff; }
.rb-scrolltext.is-split > span.on:nth-child(7n) { color: var(--wp--preset--color--cyan); }

/* ── Footer ────────────────────────────────────────────────────────────── */
.rb-footer { position: relative; overflow: hidden; isolation: isolate; }
.rb-footer::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 1px; background: linear-gradient(90deg, transparent, var(--wp--preset--color--electric), var(--wp--preset--color--cyan), var(--wp--preset--color--accent), transparent); background-size: 200% 100%; animation: rb-flow 5s linear infinite; }
.rb-footer::after { content: ""; position: absolute; z-index: -1; right: -6%; bottom: -30%; width: min(620px, 70vw); aspect-ratio: 1; background: url(assets/images/rb-mark-white.webp) center / contain no-repeat; opacity: .05; }
.rb-footer a { text-decoration: none; }
.rb-footer .rb-logo img { width: 200px; }
.rb-footer .wp-block-navigation { font-family: var(--wp--preset--font-family--display); font-size: 1.15rem; }
.rb-footer__legal { border-top: 1px solid var(--rb-border); }

/* ── Comparsa allo scroll (solo con JavaScript attivo) ─────────────────── */
html.rb-js .rb-reveal { opacity: 0; transform: translateY(34px); transition: opacity 1s var(--rb-ease), transform 1s var(--rb-ease); }
html.rb-js .rb-reveal.is-in { opacity: 1; transform: none; }
html.rb-js .rb-card.rb-reveal { transition: opacity 1s var(--rb-ease), transform .9s var(--rb-ease), border-color .3s ease, box-shadow .45s ease; }
html.rb-js .rb-card.rb-reveal.is-in { transform: perspective(1000px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)); }
html.rb-js .rb-reveal.rb-d1 { transition-delay: .5s; }
html.rb-js .rb-reveal.rb-d2 { transition-delay: .7s; }
html.rb-js .rb-reveal.rb-d3 { transition-delay: .9s; }
html.rb-js .rb-bento > .rb-reveal:nth-child(2) { transition-delay: .12s, .12s, 0s, 0s; }
html.rb-js .rb-bento > .rb-reveal:nth-child(3) { transition-delay: .24s, .24s, 0s, 0s; }
html.rb-js .rb-bento > .rb-reveal:nth-child(4) { transition-delay: .36s, .36s, 0s, 0s; }
html.rb-js .rb-bento > .rb-reveal.is-tilt { transition-delay: 0s; }

/* Bagliore che segue il puntatore (solo mouse) */
.rb-cursor { position: fixed; left: 0; top: 0; z-index: 1; width: 520px; height: 520px; margin: -260px 0 0 -260px; border-radius: 50%; pointer-events: none; background: radial-gradient(circle, rgba(61, 107, 255, .13), transparent 62%); mix-blend-mode: screen; will-change: transform; }

/* Ancore sotto l'header fisso, focus visibile */
:target { scroll-margin-top: 110px; }
html { scroll-behavior: smooth; }
:where(a, button, input, .wp-block-button__link):focus-visible { outline: 2px solid var(--wp--preset--color--cyan); outline-offset: 3px; }

/* ── Tablet e telefono ─────────────────────────────────────────────────── */
@media (max-width: 1000px) {
	.rb-bento { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.rb-bento > :nth-child(n) { grid-column: span 1; }
}
@media (max-width: 781px) {
	.rb-hero { padding-top: 120px !important; }
	.rb-hero__visual { margin-top: 1.5rem; }
	.rb-scrollcue { display: none; }
	.rb-core { margin: 0; }
}
@media (max-width: 640px) {
	.rb-bento { grid-template-columns: 1fr; }
	.rb-header .rb-logo img { width: 118px; }
	.rb-header .wp-block-navigation__container { flex-wrap: nowrap; gap: 0; }
	.rb-header .wp-block-navigation-item__content { padding: .5rem .65rem; font-size: .82rem; white-space: nowrap; }
	.rb-hero__title { font-size: clamp(2.7rem, 13vw, 3.6rem) !important; }
}

/* Movimento ridotto: tutto fermo e visibile */
@media (prefers-reduced-motion: reduce) {
	html { scroll-behavior: auto; }
	*, *::before, *::after { animation: none !important; transition: none !important; }
	html.rb-js .rb-reveal { opacity: 1; transform: none; }
	.rb-cursor { display: none; }
}
