/* Hapi Instagram — estilos do feed. Variáveis definidas inline por feed. */
.hapi-ig{--hapi-ig-cols:4;--hapi-ig-cols-t:3;--hapi-ig-cols-m:2;--hapi-ig-c:var(--hapi-ig-cols);--hapi-ig-gap:8px;--hapi-ig-ratio:1 / 1;--hapi-ig-radius:0;--hapi-ig-accent:#e1306c;--hapi-ig-text:inherit;--hapi-ig-muted:#777;color:var(--hapi-ig-text);box-sizing:border-box}
.hapi-ig *,.hapi-ig *::before,.hapi-ig *::after{box-sizing:inherit}

/* Cabeçalho */
.hapi-ig__header{display:flex;align-items:center;gap:16px;margin:0 0 20px}
.hapi-ig__avatar img{width:72px;height:72px;border-radius:50%;object-fit:cover;display:block}
.hapi-ig__username{font-weight:700;font-size:1.1em;text-decoration:none;color:inherit}
.hapi-ig__username:hover{color:var(--hapi-ig-accent)}
.hapi-ig__counts{display:flex;gap:16px;font-size:.9em;color:var(--hapi-ig-muted);margin-top:4px}
.hapi-ig__counts strong{color:var(--hapi-ig-text)}
.hapi-ig__bio{margin:6px 0 0;font-size:.9em;line-height:1.4}

/* Grid */
.hapi-ig__wrap{position:relative}
.hapi-ig__items{display:grid;grid-template-columns:repeat(var(--hapi-ig-c),minmax(0,1fr));gap:var(--hapi-ig-gap);margin:0;padding:0}
.hapi-ig__item{position:relative;margin:0;min-width:0}
.hapi-ig__link{position:relative;display:block;overflow:hidden;border-radius:var(--hapi-ig-radius);aspect-ratio:var(--hapi-ig-ratio);background:#f2f2f2;color:#fff;text-decoration:none}
.hapi-ig__img{width:100%;height:100%;object-fit:cover;display:block;transition:transform .35s ease}
.hapi-ig__link:hover .hapi-ig__img,.hapi-ig__link:focus-visible .hapi-ig__img{transform:scale(1.04)}
.hapi-ig__link:focus-visible{outline:3px solid var(--hapi-ig-accent);outline-offset:2px}

/* Masonry (colunas CSS) */
.hapi-ig--masonry .hapi-ig__items{display:block;column-count:var(--hapi-ig-c);column-gap:var(--hapi-ig-gap)}
.hapi-ig--masonry .hapi-ig__item{break-inside:avoid;margin-bottom:var(--hapi-ig-gap)}
.hapi-ig--masonry .hapi-ig__link{aspect-ratio:auto}
.hapi-ig--masonry .hapi-ig__img{height:auto}

/* Carrossel (scroll-snap) */
.hapi-ig--carousel .hapi-ig__items{display:flex;overflow-x:auto;scroll-snap-type:x mandatory;scroll-behavior:smooth;scrollbar-width:none;-webkit-overflow-scrolling:touch}
.hapi-ig--carousel .hapi-ig__items::-webkit-scrollbar{display:none}
.hapi-ig--carousel .hapi-ig__item{flex:0 0 calc((100% - (var(--hapi-ig-c) - 1) * var(--hapi-ig-gap)) / var(--hapi-ig-c));scroll-snap-align:start}
.hapi-ig__nav{position:absolute;top:50%;transform:translateY(-50%);z-index:2;width:40px;height:40px;border:0;border-radius:50%;background:rgba(255,255,255,.92);color:#222;box-shadow:0 2px 8px rgba(0,0,0,.2);cursor:pointer;font-size:14px;display:flex;align-items:center;justify-content:center}
.hapi-ig__nav--prev{left:8px}.hapi-ig__nav--next{right:8px}
.hapi-ig__nav:hover{background:#fff}
.hapi-ig__nav[disabled]{opacity:.3;cursor:default}

/* Overlay no hover */
.hapi-ig__overlay{position:absolute;inset:0;display:flex;flex-direction:column;justify-content:center;align-items:center;gap:10px;padding:12px;background:rgba(0,0,0,.55);opacity:0;transition:opacity .25s ease;text-align:center;font-size:.85em;line-height:1.4}
.hapi-ig__link:hover .hapi-ig__overlay,.hapi-ig__link:focus-visible .hapi-ig__overlay{opacity:1}
.hapi-ig__stats{display:flex;gap:14px;font-weight:600}
.hapi-ig__overlay .hapi-ig__caption{display:-webkit-box;-webkit-line-clamp:4;-webkit-box-orient:vertical;overflow:hidden;max-width:100%}
.hapi-ig__overlay .hapi-ig__caption a{color:#fff;text-decoration:underline}
@media (hover:none){.hapi-ig__overlay{display:none}}

/* Ícone do tipo de mídia */
.hapi-ig__icon{position:absolute;top:8px;right:8px;width:22px;height:22px;filter:drop-shadow(0 1px 2px rgba(0,0,0,.5));background-repeat:no-repeat;background-size:contain;pointer-events:none}
.hapi-ig__icon--video,.hapi-ig__icon--reel{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M8 5v14l11-7z'/%3E%3C/svg%3E")}
.hapi-ig__icon--carousel{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M4 6h2v14h14v2H4zM8 2h14v14H8z'/%3E%3C/svg%3E")}

/* Legenda abaixo */
.hapi-ig__below{padding:10px 2px 0;font-size:.9em;line-height:1.45}
.hapi-ig__below .hapi-ig__caption{margin:0 0 6px}
.hapi-ig__below a{color:var(--hapi-ig-accent);text-decoration:none}
.hapi-ig__date{display:block;font-size:.8em;color:var(--hapi-ig-muted)}

/* Rodapé */
.hapi-ig__footer{display:flex;justify-content:center;gap:12px;margin-top:20px;flex-wrap:wrap}
.hapi-ig__more,.hapi-ig__follow{display:inline-flex;align-items:center;justify-content:center;padding:10px 22px;border-radius:999px;font:inherit;font-size:.9em;font-weight:600;text-decoration:none;cursor:pointer;border:2px solid var(--hapi-ig-accent);transition:all .2s}
.hapi-ig__more{background:transparent;color:var(--hapi-ig-accent)}
.hapi-ig__more:hover{background:var(--hapi-ig-accent);color:#fff}
.hapi-ig__more[disabled]{opacity:.6;cursor:wait}
.hapi-ig__follow{background:var(--hapi-ig-accent);color:#fff}
.hapi-ig__follow:hover{filter:brightness(.9)}
.hapi-ig-empty{padding:12px;border:1px dashed #ccc;color:#666;font-size:.9em}

/* Responsivo. As colunas configuradas chegam inline (--hapi-ig-cols/-t/-m); a coluna efetiva fica em --hapi-ig-c,
   porque uma media query não consegue sobrescrever uma variável definida no style do elemento. */
@media (max-width:1024px){.hapi-ig{--hapi-ig-c:var(--hapi-ig-cols-t)}}
@media (max-width:640px){.hapi-ig{--hapi-ig-c:var(--hapi-ig-cols-m)}.hapi-ig__header{gap:12px}.hapi-ig__avatar img{width:56px;height:56px}}

/* Lightbox */
.hapi-ig-lb{position:fixed;inset:0;z-index:99999;display:flex;align-items:center;justify-content:center;background:rgba(0,0,0,.9);padding:16px;opacity:0;transition:opacity .2s}
.hapi-ig-lb.is-open{opacity:1}
.hapi-ig-lb[hidden]{display:none}
.hapi-ig-lb__dialog{display:grid;grid-template-columns:minmax(0,1.4fr) minmax(280px,.8fr);max-width:1100px;width:100%;max-height:92vh;background:#fff;color:#222;border-radius:8px;overflow:hidden}
.hapi-ig-lb__media{position:relative;background:#000;display:flex;align-items:center;justify-content:center;min-height:300px}
.hapi-ig-lb__stage{display:flex;align-items:center;justify-content:center;width:100%;height:100%}
.hapi-ig-lb__media img,.hapi-ig-lb__media video{max-width:100%;max-height:92vh;width:auto;height:auto;display:block}
.hapi-ig-lb__side{display:flex;flex-direction:column;min-width:0;max-height:92vh}
.hapi-ig-lb__head{display:flex;align-items:center;gap:10px;padding:14px 16px;border-bottom:1px solid #eee;font-weight:600}
.hapi-ig-lb__head img{width:36px;height:36px;border-radius:50%}
.hapi-ig-lb__body{padding:14px 16px;overflow:auto;flex:1;font-size:.92em;line-height:1.5}
.hapi-ig-lb__body a{color:var(--hapi-ig-accent,#e1306c);text-decoration:none}
.hapi-ig-lb__foot{padding:12px 16px;border-top:1px solid #eee;display:flex;justify-content:space-between;align-items:center;gap:12px;font-size:.85em;color:#666}
.hapi-ig-lb__foot a{color:var(--hapi-ig-accent,#e1306c);font-weight:600;text-decoration:none;white-space:nowrap}
.hapi-ig-lb__btn{position:absolute;z-index:3;width:44px;height:44px;border:0;border-radius:50%;background:rgba(255,255,255,.9);color:#222;cursor:pointer;font-size:18px;display:flex;align-items:center;justify-content:center;box-shadow:0 2px 8px rgba(0,0,0,.3)}
.hapi-ig-lb__close{top:12px;right:12px}
.hapi-ig-lb__prev{left:12px;top:50%;transform:translateY(-50%)}
.hapi-ig-lb__next{right:12px;top:50%;transform:translateY(-50%)}
.hapi-ig-lb__btn[hidden]{display:none}
.hapi-ig-lb__cprev,.hapi-ig-lb__cnext{top:50%;transform:translateY(-50%);width:36px;height:36px;font-size:14px}
.hapi-ig-lb__cprev{left:10px}.hapi-ig-lb__cnext{right:10px}
.hapi-ig-lb__dots{position:absolute;bottom:10px;left:0;right:0;display:flex;justify-content:center;gap:6px}
.hapi-ig-lb__dots span{width:7px;height:7px;border-radius:50%;background:rgba(255,255,255,.5)}
.hapi-ig-lb__dots span.is-active{background:#fff}
@media (max-width:800px){.hapi-ig-lb{padding:0}.hapi-ig-lb__dialog{grid-template-columns:1fr;grid-template-rows:auto minmax(0,1fr);max-height:100vh;height:100%;border-radius:0}.hapi-ig-lb__media{min-height:0;max-height:60vh}.hapi-ig-lb__media img,.hapi-ig-lb__media video{max-height:60vh}.hapi-ig-lb__side{max-height:none}}
body.hapi-ig-lb-open{overflow:hidden}

/* ===== Melhorias visuais (v1.1) ===== */

/* Overlay com cores configuráveis */
.hapi-ig{--hapi-ig-overlay:rgba(0,0,0,.55);--hapi-ig-overlay-text:#fff}
.hapi-ig .hapi-ig__overlay{background:var(--hapi-ig-overlay);color:var(--hapi-ig-overlay-text)}
.hapi-ig .hapi-ig__overlay a{color:inherit}
.hapi-ig__hover-date{font-size:.8em;opacity:.85}

/* Hover: gradiente inferior */
.hapi-ig--hover-gradient .hapi-ig__overlay{background:linear-gradient(to top,var(--hapi-ig-overlay) 0%,rgba(0,0,0,0) 75%);justify-content:flex-end;align-items:flex-start;text-align:left;padding:14px;gap:6px}
.hapi-ig--hover-gradient .hapi-ig__stats{order:2;font-size:.9em}
.hapi-ig--hover-gradient .hapi-ig__overlay .hapi-ig__caption{-webkit-line-clamp:3}

/* Hover: painel que sobe */
.hapi-ig--hover-slide .hapi-ig__overlay{top:auto;max-height:75%;opacity:1;transform:translateY(102%);transition:transform .3s ease;justify-content:flex-end;align-items:flex-start;text-align:left;padding:12px 14px;gap:6px}
.hapi-ig--hover-slide .hapi-ig__link:hover .hapi-ig__overlay,.hapi-ig--hover-slide .hapi-ig__link:focus-visible .hapi-ig__overlay{transform:none}
.hapi-ig--hover-slide .hapi-ig__stats{order:2;font-size:.9em}

/* Hover: só zoom / nenhum */
.hapi-ig--hover-none .hapi-ig__link:hover .hapi-ig__img,.hapi-ig--hover-none .hapi-ig__link:focus-visible .hapi-ig__img{transform:none}

/* Layout highlight: 1 post grande a cada N */
.hapi-ig--highlight .hapi-ig__items{grid-auto-flow:dense}
.hapi-ig--highlight .hapi-ig__item.is-highlight{grid-column:span 2;grid-row:span 2}
@media (max-width:640px){.hapi-ig--highlight .hapi-ig__item.is-highlight{grid-column:1 / -1}}

/* Preset: light (cartão) */
.hapi-ig--preset-light{background:#fff;padding:24px;border-radius:14px;box-shadow:0 6px 28px rgba(0,0,0,.08)}

/* Preset: dark */
.hapi-ig--preset-dark{background:#111;padding:24px;border-radius:14px;--hapi-ig-text:#fff;--hapi-ig-muted:#9a9a9a;color:#fff}
.hapi-ig--preset-dark .hapi-ig__link{background:#222}
.hapi-ig--preset-dark .hapi-ig__more{color:#fff;border-color:#fff}
.hapi-ig--preset-dark .hapi-ig__more:hover{background:#fff;color:#111}
.hapi-ig--preset-dark .hapi-ig__dots button{background:#444}

/* Preset: minimal */
.hapi-ig--preset-minimal .hapi-ig__icon{display:none}
.hapi-ig--preset-minimal .hapi-ig__header{margin-bottom:12px}

/* Preset: polaroid */
.hapi-ig--preset-polaroid .hapi-ig__items{gap:calc(var(--hapi-ig-gap) + 18px);padding:8px}
.hapi-ig--preset-polaroid .hapi-ig__item{background:#fff;padding:10px 10px 12px;box-shadow:0 8px 22px rgba(0,0,0,.16);border-radius:3px;transform:rotate(-1.5deg);transition:transform .3s ease,box-shadow .3s ease}
.hapi-ig--preset-polaroid .hapi-ig__item:nth-child(even){transform:rotate(1.5deg)}
.hapi-ig--preset-polaroid .hapi-ig__item:nth-child(3n){transform:rotate(-.6deg)}
.hapi-ig--preset-polaroid .hapi-ig__item:hover{transform:rotate(0) scale(1.03);box-shadow:0 14px 34px rgba(0,0,0,.22);z-index:1}
.hapi-ig--preset-polaroid .hapi-ig__link{border-radius:0;background:#eee}
.hapi-ig--preset-polaroid .hapi-ig__below{color:#333;font-family:"Caveat","Segoe Print","Bradley Hand",cursive;font-size:1.05em;line-height:1.3;padding-top:12px}
.hapi-ig--preset-polaroid .hapi-ig__below .hapi-ig__caption{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
.hapi-ig--preset-polaroid .hapi-ig__below a{color:#555}

/* Carrossel: 2 linhas */
.hapi-ig--rows-2 .hapi-ig__items{display:grid;grid-template-columns:none;grid-auto-flow:column;grid-template-rows:repeat(2,minmax(0,1fr));grid-auto-columns:calc((100% - (var(--hapi-ig-c) - 1) * var(--hapi-ig-gap)) / var(--hapi-ig-c));overflow-x:auto;scroll-snap-type:x mandatory;scroll-behavior:smooth}
.hapi-ig--rows-2 .hapi-ig__item{flex:none;min-width:0}

/* Carrossel: pontos */
.hapi-ig__dots{display:flex;justify-content:center;gap:8px;margin-top:14px}
.hapi-ig__dots:empty{display:none}
.hapi-ig__dots button{width:8px;height:8px;border-radius:50%;border:0;padding:0;background:#c9c9c9;cursor:pointer;transition:transform .2s,background .2s}
.hapi-ig__dots button.is-active{background:var(--hapi-ig-accent);transform:scale(1.3)}

/* Lightbox: compartilhar */
.hapi-ig-lb__share{display:flex;gap:6px;padding:10px 16px;border-top:1px solid #eee;align-items:center;flex-wrap:wrap}
.hapi-ig-lb__share:empty{display:none}
.hapi-ig-lb__share a,.hapi-ig-lb__share button{display:inline-flex;align-items:center;padding:6px 12px;border-radius:999px;border:1px solid #e3e3e3;background:#fafafa;color:#333;cursor:pointer;text-decoration:none;font:inherit;font-size:.78em;font-weight:600;line-height:1;transition:background .2s}
.hapi-ig-lb__share a:hover,.hapi-ig-lb__share button:hover{background:#eee}
.hapi-ig-lb__share .is-copied{background:#2e7d32;color:#fff;border-color:#2e7d32}
