/* =========================================================
   GALERIA — álbuns em cartões e visualizador em modal
   ========================================================= */

/* ---------- Introdução ---------- */
.gl-intro { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px 48px; flex-wrap: wrap; margin-bottom: 34px; }
.gl-intro-text { max-width: 640px; }
.gl-intro h2 { font-size: clamp(24px, 3vw, 34px); line-height: 1.2; letter-spacing: -.01em; text-transform: none; margin: 0 0 12px; }
.gl-intro p { margin: 0; font-size: 15.5px; line-height: 1.85; }
.gl-stats { list-style: none; margin: 0; padding: 0; display: flex; gap: 12px; flex-wrap: wrap; }
.gl-stats li { display: flex; align-items: center; gap: 10px; margin: 0; padding: 10px 18px 10px 10px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); }
.gl-stat-ico { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; background: var(--accent-soft); color: var(--accent); }
html[data-theme="dark"] .gl-stat-ico { color: color-mix(in srgb, var(--accent) 45%, #9fe0b9); }
.gl-stats strong { font-family: var(--font-head); font-size: 14.5px; color: var(--heading); white-space: nowrap; }

/* ---------- Filtro por categoria ---------- */
.gl-filter { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 34px; padding-bottom: 22px; border-bottom: 1px solid var(--border); }
.gl-filter a { display: inline-flex; align-items: center; min-height: 38px; padding: 0 18px; border-radius: 999px; border: 1px solid var(--input-border, var(--border)); font-family: var(--font-head); font-size: 12.5px; font-weight: 600; letter-spacing: .03em; color: var(--text) !important; background: var(--surface); transition: background .2s, color .2s, border-color .2s; }
.gl-filter a:hover { border-color: var(--accent); color: var(--accent) !important; }
.gl-filter a.active { background: var(--accent); border-color: var(--accent); color: #fff !important; }

/* ---------- Cartões de álbum ---------- */
.gl-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 38px 30px; }
.gl-card { position: relative; display: flex; flex-direction: column; transition-delay: var(--d, 0ms); }
.gl-open { display: block; color: var(--heading) !important; border-radius: 16px; outline-offset: 6px; }
.gl-stack { position: relative; display: block; padding-top: 12px; }
/* Folhas por trás da capa: aspeto de álbum */
.gl-stack::before, .gl-stack::after { content: ""; position: absolute; left: 7%; right: 7%; top: 6px; height: 40px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); box-shadow: 0 2px 8px rgba(0, 0, 0, .05); transition: transform .4s var(--ease, ease); }
.gl-stack::before { top: 0; left: 13%; right: 13%; opacity: .7; }
.gl-cover { position: relative; z-index: 1; display: block; aspect-ratio: 4 / 3; overflow: hidden; border-radius: 14px; background: var(--bg-alt); box-shadow: 0 14px 32px rgba(10, 30, 18, .14); }
.gl-cover img { width: 100%; height: 100%; object-fit: cover; transition: transform .7s var(--ease, ease), filter .3s; }
.gl-open:hover .gl-cover img, .gl-open:focus-visible .gl-cover img { transform: scale(1.06); }
.gl-open:hover .gl-stack::after { transform: translateY(-4px) rotate(-1.2deg); }
.gl-open:hover .gl-stack::before { transform: translateY(-6px) rotate(1.6deg); }
.gl-hover { position: absolute; inset: 0; display: grid; place-items: center; background: linear-gradient(180deg, rgba(8, 20, 13, 0) 30%, rgba(8, 20, 13, .55)); opacity: 0; transition: opacity .3s; }
.gl-open:hover .gl-hover, .gl-open:focus-visible .gl-hover { opacity: 1; }
.gl-hover-btn { display: inline-flex; align-items: center; gap: 8px; padding: 11px 20px; border-radius: 999px; background: #fff; color: #1b1d21; font-family: var(--font-head); font-size: 12.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; box-shadow: 0 10px 24px rgba(0, 0, 0, .25); transform: translateY(8px); transition: transform .3s var(--ease, ease); }
.gl-open:hover .gl-hover-btn { transform: none; }
.gl-count { position: absolute; left: 12px; bottom: 12px; display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px; background: rgba(10, 16, 13, .72); color: #fff; font-family: var(--font-head); font-size: 12px; font-weight: 700; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.gl-body { display: block; padding: 18px 2px 0; }
.gl-cat { display: inline-block; margin-bottom: 8px; padding: 3px 10px; border-radius: 999px; font-family: var(--font-head); font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--c, var(--accent)); background: color-mix(in srgb, var(--c, var(--accent)) 12%, transparent); }
html[data-theme="dark"] .gl-cat { color: color-mix(in srgb, var(--c, var(--accent)) 55%, #fff); background: color-mix(in srgb, var(--c, var(--accent)) 24%, transparent); }
.gl-title { display: block; font-family: var(--font-head); font-size: 16.5px; font-weight: 700; line-height: 1.4; color: var(--heading); transition: color .2s; }
.gl-open:hover .gl-title { color: var(--accent); }
html[data-theme="dark"] .gl-open:hover .gl-title { color: color-mix(in srgb, var(--accent) 45%, #9fe0b9); }
.gl-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: auto; padding: 12px 2px 0; }
.gl-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; color: var(--muted); }
.gl-meta time { display: inline-flex; align-items: center; gap: 6px; }
.gl-page { flex-shrink: 0; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--input-border, var(--border)); color: var(--muted) !important; transition: all .2s; }
.gl-page:hover, .gl-page:focus-visible { background: var(--accent); border-color: var(--accent); color: #fff !important; }

/* ---------- Visualizador (modal) ---------- */
.gl-modal { position: fixed; inset: 0; z-index: 1000; display: flex; opacity: 0; transition: opacity .22s ease; }
.gl-modal[hidden] { display: none; }
.gl-modal.is-open { opacity: 1; }
.gl-m-backdrop { position: absolute; inset: 0; background: rgba(6, 10, 8, .94); }
.gl-m-shell { position: relative; z-index: 1; display: flex; flex-direction: column; width: 100%; height: 100%; color: #fff; }
.gl-m-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px clamp(16px, 3vw, 32px); border-bottom: 1px solid rgba(255, 255, 255, .08); }
.gl-m-info { min-width: 0; }
.gl-m-info h2 { margin: 0; color: #fff; font-size: clamp(15px, 1.6vw, 18px); line-height: 1.35; text-transform: none; letter-spacing: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gl-m-meta { display: flex; gap: 14px; margin: 3px 0 0; font-size: 12.5px; color: rgba(255, 255, 255, .62); }
.gl-m-counter { font-family: var(--font-head); font-weight: 700; color: var(--accent-2); }
.gl-m-tools { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.gl-m-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-width: 42px; height: 42px; padding: 0 12px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, .16); background: rgba(255, 255, 255, .06); color: #fff !important; font-family: var(--font-head); font-size: 12px; font-weight: 700; letter-spacing: .03em; cursor: pointer; transition: background .2s, border-color .2s; }
.gl-m-btn:hover, .gl-m-btn:focus-visible { background: rgba(255, 255, 255, .16); border-color: rgba(255, 255, 255, .3); }
.gl-m-btn .i-pause, .gl-modal.is-playing .gl-m-btn .i-play { display: none; }
.gl-modal.is-playing .gl-m-btn .i-pause { display: block; }
.gl-modal.is-playing [data-gl-play] { background: var(--accent-2); border-color: var(--accent-2); }

.gl-m-stage { position: relative; flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 18px clamp(64px, 7vw, 100px); }
.gl-m-figure { position: relative; margin: 0; width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.gl-m-figure img { max-width: 100%; max-height: calc(100% - 34px); object-fit: contain; border-radius: 8px; box-shadow: 0 30px 70px rgba(0, 0, 0, .55); transition: opacity .25s ease; }
.gl-modal.is-switching .gl-m-figure img { opacity: .35; }
.gl-modal.is-loading .gl-m-figure img { opacity: 0; }
.gl-m-figure figcaption { margin-top: 12px; max-width: 760px; text-align: center; font-size: 14px; line-height: 1.6; color: rgba(255, 255, 255, .8); }
.gl-m-loader { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; color: rgba(255, 255, 255, .7); font-size: 13.5px; pointer-events: none; }
.gl-m-loader[hidden] { display: none; }
.gl-m-loader span { width: 38px; height: 38px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, .18); border-top-color: var(--accent-2); animation: glSpin .8s linear infinite; }
.gl-m-loader p { margin: 0; }
@keyframes glSpin { to { transform: rotate(360deg); } }
.gl-m-nav { position: absolute; top: 50%; z-index: 2; width: 52px; height: 52px; margin-top: -26px; display: grid; place-items: center; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .16); background: rgba(255, 255, 255, .07); color: #fff; cursor: pointer; transition: background .2s, transform .2s; }
.gl-m-nav:hover, .gl-m-nav:focus-visible { background: var(--accent); border-color: var(--accent); }
.gl-m-nav.prev { left: clamp(8px, 2vw, 28px); }
.gl-m-nav.next { right: clamp(8px, 2vw, 28px); }
.gl-modal.is-single .gl-m-nav, .gl-modal.is-single .gl-m-thumbs, .gl-modal.is-single [data-gl-play] { display: none; }

.gl-m-thumbs { display: flex; gap: 8px; padding: 12px clamp(16px, 3vw, 32px) 18px; overflow-x: auto; scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, .25) transparent; scroll-behavior: smooth; justify-content: safe center; }
.gl-m-thumbs button { flex-shrink: 0; width: 76px; height: 56px; padding: 0; border: 2px solid transparent; border-radius: 8px; overflow: hidden; background: rgba(255, 255, 255, .06); cursor: pointer; opacity: .55; transition: opacity .2s, border-color .2s, transform .2s; }
.gl-m-thumbs button:hover { opacity: .9; }
.gl-m-thumbs button.is-active { opacity: 1; border-color: var(--accent-2); transform: translateY(-2px); }
.gl-m-thumbs img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ---------- Página do álbum ---------- */
.gl-album-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.gl-album-actions .btn { display: inline-flex; align-items: center; gap: 8px; }

/* ---------- Responsivo ---------- */
@media (max-width: 1000px) {
    .gl-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px 22px; }
}
@media (max-width: 640px) {
    .gl-intro { margin-bottom: 26px; }
    .gl-stats li { padding: 6px 14px 6px 6px; }
    .gl-stat-ico { width: 32px; height: 32px; }
    .gl-filter { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-left: calc(var(--gutter, 16px) * -1); margin-right: calc(var(--gutter, 16px) * -1); padding-left: var(--gutter, 16px); padding-right: var(--gutter, 16px); }
    .gl-filter::-webkit-scrollbar { display: none; }
    .gl-filter a { flex-shrink: 0; }
    .gl-grid { grid-template-columns: minmax(0, 1fr); gap: 30px; }
    .gl-hover { opacity: 1; background: none; }
    .gl-hover-btn { display: none; }
    .gl-m-head { padding: 12px 14px; }
    .gl-m-page span { display: none; }
    .gl-m-stage { padding: 10px 8px; }
    .gl-m-nav { width: 42px; height: 42px; margin-top: -21px; background: rgba(0, 0, 0, .45); }
    .gl-m-nav.prev { left: 6px; }
    .gl-m-nav.next { right: 6px; }
    .gl-m-thumbs button { width: 60px; height: 46px; }
}
@media (prefers-reduced-motion: reduce) {
    .gl-cover img, .gl-stack::before, .gl-stack::after, .gl-modal, .gl-m-figure img { transition: none; }
}

/* ---------- Carregar mais ---------- */
.gl-more { display: flex; flex-direction: column; align-items: center; gap: 14px; margin-top: 52px; text-align: center; }
.gl-more-status { margin: 0; font-size: 14px; color: var(--muted); }
.gl-more-status strong { color: var(--heading); font-family: var(--font-head); }
.gl-more-bar { display: block; width: min(260px, 70%); height: 4px; border-radius: 4px; background: var(--border); overflow: hidden; }
.gl-more-bar span { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .5s var(--ease, ease); }
.gl-more-btn { display: inline-flex; align-items: center; gap: 10px; margin-top: 6px; min-width: 240px; justify-content: center; border-radius: 999px; }
.gl-more-spin { display: none; width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .35); border-top-color: #fff; animation: glSpin .7s linear infinite; }
.gl-more-btn.is-loading { pointer-events: none; opacity: .85; }
.gl-more-btn.is-loading .gl-more-spin { display: inline-block; }
.gl-more-btn.is-loading svg { display: none; }
.gl-card.gl-new { animation: glIn .55s var(--ease, ease) both; }
@keyframes glIn { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .gl-card.gl-new { animation: none; } }
