:root {
  --bg: #050507;
  --glass: #141a2b;
  --cyan: #38bdf8;
  --orange: #ff8c28;
  --font: Poppins, system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { background: var(--bg); color: #fff; font-family: var(--font); -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: 100%; }
body { background: var(--bg); min-height: 100vh; }
::selection { background: rgb(56 189 248 / .35); }
a { color: inherit; }

.topo { background: linear-gradient(180deg, #ffa24d, #ff8c28); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ───────────── Versão WebGL ───────────── */
html.gl .static { display: none; }
html.gl body { height: 100vh; overflow: hidden; }
html.gl, html.gl body { overscroll-behavior: none; }
.defs, .back { display: none; }
html.gl .defs, html.gl .back { display: block; }

.gl-canvas { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }

/* Cópia transparente do texto, colada ao painel inclinado por homografia */
.layer { position: fixed; left: 0; top: 0; z-index: 1; transform-origin: 0 0; color: transparent; font-family: var(--font); opacity: 0; transition: opacity .3s; }
.layer.is-on { opacity: 1; }
.layer:not(.is-on) * { pointer-events: none; }
.layer > * { position: absolute; white-space: nowrap; }
.layer a, .layer button { color: transparent; text-decoration: none; background: none; border: 0; font: inherit; cursor: pointer; border-radius: 6px; }
.layer ::selection { background: rgb(56 189 248 / .4); color: transparent; }
.layer a:focus-visible, .layer button:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; }

/* Vista revelada depois de estilhaçar */
.defs { position: fixed; inset: 0; z-index: 2; opacity: 0; visibility: hidden; transition: opacity .25s, visibility 0s .25s; }
.defs.is-on { opacity: 1; visibility: visible; transition: opacity .4s; }
.defs__col { position: absolute; left: 32.4vw; width: 33.9vw; top: calc(35.9vh - .95 * max(18px, 1.36vw)); }
.defs h2 { font-weight: 600; font-size: max(18px, 1.36vw); line-height: 1.2; letter-spacing: -.022em; margin-bottom: max(14px, 1.5vw); }
.defs p { font-size: max(12px, .73vw); line-height: 1.72; color: rgb(255 255 255 / .6); }
.defs p + p { margin-top: max(10px, 1.05vw); }
.defs b { color: #fff; font-weight: 600; }
.defs__wa { display: inline-block; margin-top: max(16px, 1.6vw); font-size: max(12px, .73vw); font-weight: 500; color: var(--cyan); text-decoration: none; }
.defs__wa:hover, .defs__wa:focus-visible { text-decoration: underline; text-underline-offset: 3px; }
.defs p.defs__mail { margin-top: max(8px, .6vw); }
.defs__mail a { color: #fff; text-decoration: none; }
.defs__mail a:hover, .defs__mail a:focus-visible { color: var(--cyan); text-decoration: underline; text-underline-offset: 3px; }

/* "← Voltar": o texto fica por cima do estilhaço desenhado em WebGL */
.back { position: fixed; z-index: 3; left: 14.7vw; top: 16.9vh; width: 14vw; height: 10.8vh; background: none; border: 0; color: #fff; cursor: pointer; opacity: 0; pointer-events: none; font: 500 max(11px, .66vw) var(--font); }
.back.is-on { pointer-events: auto; }
.back span { position: absolute; left: 7.2vw; top: 6.9vh; transform: translate(-50%, -50%); white-space: nowrap; transition: color .2s; }
.back:hover span, .back:focus-visible span { color: var(--cyan); }
.back:focus-visible { outline: none; }

/* WebGL no telemóvel: a vista dos serviços ocupa o ecrã todo e faz scroll */
html.gl-compact .defs { overflow-y: auto; -webkit-overflow-scrolling: touch; }
html.gl-compact .defs__col { left: 7vw; width: 86vw; top: 22vh; padding-bottom: 3rem; }
html.gl-compact .defs h2 { font-size: 22px; margin-bottom: 18px; }
html.gl-compact .defs p, html.gl-compact .defs__wa { font-size: 14px; }
html.gl-compact .defs p + p { margin-top: 12px; }
html.gl-compact .defs__wa { margin-top: 20px; }

/* ───────────── Versão estática ───────────── */
.static { --pad: clamp(16px, 5.5vw, 80px); }

.s-nav { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 2rem; height: 72px; padding: 0 var(--pad); background: rgb(5 5 7 / .8); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid rgb(255 255 255 / .06); }
.s-nav__logo img { display: block; height: 44px; width: auto; }
.s-nav__links { display: flex; gap: 1.8rem; margin-left: auto; font-size: .92rem; }
.s-nav__links a, .s-nav__wa { text-decoration: none; color: rgb(255 255 255 / .6); transition: color .2s; }
.s-nav__links a:hover { color: #fff; }
.s-nav__wa { color: #fff; font-size: .92rem; font-weight: 500; padding: .45rem .9rem; border: 1px solid rgb(255 255 255 / .16); border-radius: 6px; }
.s-nav__wa:hover { border-color: var(--cyan); color: var(--cyan); }

.s-hero { position: relative; will-change: transform; margin: 14px var(--pad) 0; min-height: min(78vh, 760px); display: flex; align-items: center; border-radius: 20px; overflow: hidden; }
.s-hero__inner { position: relative; z-index: 1; padding: clamp(2.5rem, 7vw, 6rem) clamp(1.4rem, 6vw, 6rem); }

/* Estilhaços de vidro desenhados em CSS (o mesmo padrão de cortes da versão WebGL) */
.s-shards { position: absolute; inset: 0; }
.s-shards i { position: absolute; inset: 0; background: radial-gradient(circle at calc(30% + var(--tx, 0) * 40%) calc(25% + var(--ty, 0) * 40%), rgb(56 189 248 / .1), transparent 45%), linear-gradient(160deg, rgb(255 255 255 / .07), transparent 35%), linear-gradient(200deg, #18203a, var(--glass) 45%, #0d111d); transform: scale(.988); }
.s-shards i:nth-child(1) { clip-path: polygon(0 0, 22% 0, 38.5% 72%, 34% 100%, 0 100%); transform-origin: 19% 54%; }
.s-shards i:nth-child(2) { clip-path: polygon(22% 0, 51.5% 0, 48% 62%, 38.5% 72%); transform-origin: 40% 34%; }
.s-shards i:nth-child(3) { clip-path: polygon(51.5% 0, 84% 0, 71.6% 49%, 48% 62%); transform-origin: 64% 28%; }
.s-shards i:nth-child(4) { clip-path: polygon(38.5% 72%, 48% 62%, 71.6% 49%, 86.5% 100%, 34% 100%); transform-origin: 56% 77%; }
.s-shards i:nth-child(5) { clip-path: polygon(84% 0, 100% 0, 100% 100%, 86.5% 100%, 71.6% 49%); transform-origin: 88% 50%; }
.s-shards b { position: absolute; left: 71.6%; top: 49%; width: 34px; height: 34px; margin: -17px; border-radius: 50%; background: radial-gradient(circle, #fff3e0 0 10%, rgb(255 140 40 / .9) 22%, rgb(255 140 40 / 0) 70%); animation: vt-pulse 2.8s ease-in-out infinite; }
@keyframes vt-pulse { 50% { transform: scale(1.3); opacity: .8; } }

/* Conteúdo que aparece ao fazer scroll (só com JS e sem movimento reduzido) */
.rv-on .rv { opacity: 0; transform: translateY(18px); transition: opacity .7s ease, transform .7s cubic-bezier(.2, .7, .2, 1); }
.rv-on .rv.in { opacity: 1; transform: none; }

.s-eyebrow { font-size: .72rem; letter-spacing: .2em; color: rgb(255 255 255 / .45); margin-bottom: 1.2rem; }
.s-hero h1 { font-weight: 500; font-size: clamp(2.6rem, 8vw, 6.4rem); line-height: .97; letter-spacing: -.045em; background: linear-gradient(180deg, #dcdce0, #bdbdc3); -webkit-background-clip: text; background-clip: text; color: transparent; padding-bottom: .08em; }
.s-hero h1 .topo { -webkit-text-fill-color: transparent; }
.s-sub { margin-top: 1.6rem; max-width: 46rem; font-size: clamp(.95rem, 1.6vw, 1.1rem); line-height: 1.6; color: rgb(255 255 255 / .6); }
.s-cta { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 1.6rem; margin-top: 2.2rem; }
.pill { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 1.4rem; border-radius: 6px; background: #ececf0; color: #0b0b10; font-weight: 500; font-size: .95rem; text-decoration: none; transition: background .2s, color .2s; }
.pill:hover, .pill:focus-visible { background: var(--orange); }
.s-link { color: rgb(255 255 255 / .85); text-decoration: none; font-size: .95rem; font-weight: 500; }
.s-link:hover { text-decoration: underline; text-underline-offset: 4px; }
.s-link--cyan { color: var(--cyan); }

.s-services, .s-contact { padding: clamp(4rem, 9vw, 7rem) var(--pad) 0; }
.s-services h2, .s-contact h2 { font-weight: 600; font-size: clamp(1.6rem, 3.4vw, 2.4rem); letter-spacing: -.022em; line-height: 1.15; max-width: 22ch; }
.s-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr)); gap: 14px; margin-top: 2.4rem; }
.s-grid article { padding: 1.6rem; border-radius: 16px; background: linear-gradient(160deg, rgb(255 255 255 / .06), transparent 40%), var(--glass); border: 1px solid rgb(255 255 255 / .08); }
.s-grid h3 { font-weight: 600; font-size: 1.05rem; margin-bottom: .4rem; }
.s-grid p { color: rgb(255 255 255 / .6); font-size: .93rem; line-height: 1.65; }
.s-contact p { margin-top: 1rem; color: rgb(255 255 255 / .6); }
.s-contact__list { list-style: none; margin-top: 2rem; display: grid; gap: .5rem; color: rgb(255 255 255 / .6); font-size: .95rem; }
.s-contact__list b { display: inline-block; min-width: 6rem; color: #fff; font-weight: 500; }
.s-contact__list a { color: var(--cyan); text-decoration: none; overflow-wrap: anywhere; }
.s-contact__list a:hover { text-decoration: underline; }

.s-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .6rem 2rem; padding: clamp(4rem, 8vw, 6rem) var(--pad) 2rem; font-size: .78rem; color: rgb(255 255 255 / .34); }

.wa-float { position: fixed; right: 16px; bottom: 16px; z-index: 20; width: 56px; height: 56px; display: grid; place-items: center; border-radius: 50%; background: #25d366; color: #fff; box-shadow: 0 10px 30px -8px rgb(0 0 0 / .6); transition: transform .2s; }
.wa-float:hover { transform: scale(1.06); }
.wa-float svg { width: 30px; height: 30px; }

@media (max-width: 760px) {
  .s-nav { gap: 1rem; height: 64px; }
  .s-nav__logo img { height: 38px; }
  .s-nav__links { gap: 1rem; font-size: .85rem; }
  .s-nav__wa { display: none; }
  .br-lg { display: none; }
}
@media (max-width: 420px) {
  .s-nav__links { gap: .8rem; font-size: .8rem; }
  .s-foot { padding-bottom: 88px; }
}
/* Ecrãs ao alto: padrão transposto, com o estilhaço principal em cima */
@media (orientation: portrait) {
  .s-hero { min-height: min(82vh, 820px); align-items: flex-start; }
  .s-shards i:nth-child(1) { clip-path: polygon(0 0, 0 22%, 72% 38.5%, 100% 34%, 100% 0); transform-origin: 54% 19%; }
  .s-shards i:nth-child(2) { clip-path: polygon(0 22%, 0 51.5%, 62% 48%, 72% 38.5%); transform-origin: 34% 40%; }
  .s-shards i:nth-child(3) { clip-path: polygon(0 51.5%, 0 84%, 49% 71.6%, 62% 48%); transform-origin: 28% 64%; }
  .s-shards i:nth-child(4) { clip-path: polygon(72% 38.5%, 62% 48%, 49% 71.6%, 100% 86.5%, 100% 34%); transform-origin: 77% 56%; }
  .s-shards i:nth-child(5) { clip-path: polygon(0 84%, 0 100%, 100% 100%, 100% 86.5%, 49% 71.6%); transform-origin: 50% 88%; }
  .s-shards b { left: 49%; top: 71.6%; }
}
@media (prefers-reduced-motion: reduce) {
  .layer, .defs, .pill, .wa-float { transition: none; }
  .s-shards b { animation: none; }
}
