/* ============================================================
   Componentes: cards, widgets, alerts, lightbox, carousel
   ============================================================ */

/* ----- Page hero / list heading ----- */
.list-heading {
    margin-bottom: 24px;
    padding: 18px 22px;
    background: var(--surface, #fff);
    border: 1px solid var(--border, #c8c8c8);
    border-left: 5px solid var(--brand-red, #DD3333);
}
.list-heading h1 {
    margin: 0 0 4px;
    font-size: 22px;
    font-weight: 700;
    color: var(--heading, #333);
    text-transform: uppercase;
    letter-spacing: .03em;
}
.list-heading p { margin: 0; color: var(--muted, #666); font-size: 14px; }
.list-heading p strong { color: var(--brand-red, #DD3333); font-weight: 700; }

/* ----- Posts list (vertical, image overlay cards) ----- */
.posts-grid {
    display: flex; flex-direction: column;
    gap: 24px;
}
.posts-grid .post-card--featured { /* (no special treatment now) */ }

.post-card {
    position: relative;
    display: block;
    background: #222;
    overflow: hidden;
    color: #fff;
    border: 0;
    border-radius: 0;
    transition: transform .2s;
    margin-bottom: 20px;
}
.posts-grid .post-card { margin-bottom: 0; }
.post-card:hover {
    transform: none;
    border-color: transparent;
    box-shadow: 0 6px 24px rgba(0,0,0,.18);
}
.post-card__media {
    display: block;
    position: relative;
    background: #1a1a1a;
    overflow: hidden;
}
.post-card__media img {
    width: 100%;
    height: 420px;
    object-fit: cover;
    display: block;
    transition: transform .4s ease, opacity .25s, filter .25s;
}
.post-card:hover .post-card__media img { transform: scale(1.04); opacity: .85; }
:root[data-theme="dark"] .post-card__media img { filter: brightness(.55) saturate(.9); }
:root[data-theme="dark"] .post-card:hover .post-card__media img { filter: brightness(.7) saturate(.95); }
.post-card__media::after {
    content: "";
    position: absolute; inset: 0;
    background: linear-gradient(180deg, rgba(0,0,0,.05) 0%, rgba(0,0,0,.35) 50%, rgba(0,0,0,.85) 100%);
    pointer-events: none;
}

.post-card__body {
    position: absolute;
    inset: auto 0 0 0;
    padding: 30px 40px;
    z-index: 2;
    display: flex; flex-direction: column;
    gap: 10px;
}
.post-card__cats { display: flex; flex-wrap: wrap; gap: 6px; }
.post-card__cats a {
    background: var(--brand-red, #DD3333);
    color: #fff;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .05em;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 2px;
}
.post-card__cats a:hover { background: #b91c1c; text-decoration: none; }

.post-card__title {
    margin: 0;
    font-size: clamp(24px, 1.4vw + 18px, 36px);
    font-weight: 600;
    line-height: 1.2;
    color: #fff;
    letter-spacing: -.005em;
}
.post-card__title a { color: #fff; }
.post-card__title a:hover { color: #fff; text-decoration: underline; }

.post-card__meta {
    display: flex; flex-wrap: wrap; gap: 14px;
    color: rgba(255,255,255,.85);
    font-size: 13px;
    font-weight: 300;
}
.post-card__meta i { margin-right: 4px; opacity: .9; }
.post-card__excerpt { display: none; }
.post-card__more { display: none; }

@media (max-width: 760px) {
    .post-card__media img { height: 260px; }
    .post-card__body { padding: 18px 18px; }
    .post-card__title { font-size: 22px; }
}

/* ----- Search form ----- */
.search-bar {
    display: flex; gap: .5rem;
    margin-bottom: 2rem;
    max-width: 700px;
}
.search-bar input[type="search"] {
    flex: 1;
    padding: .65rem 1rem;
    border: 1px solid var(--border, #c8c8c8);
    border-radius: 4px;
    background: var(--surface, #fff);
    color: var(--text, #333);
    font-size: 1rem;
}
.search-bar input[type="search"]:focus { outline: 2px solid var(--brand-red, #DD3333); outline-offset: 1px; }
.search-bar .btn-red { width: auto; white-space: nowrap; }

/* ----- Search result list ----- */
.search-list { display: flex; flex-direction: column; gap: 20px; }
.search-item {
    display: flex; gap: 0;
    border: 1px solid var(--border, #c8c8c8);
    border-radius: 6px;
    background: var(--surface, #fff);
    text-decoration: none;
    transition: background .15s;
    overflow: hidden;
}
.search-item:hover { background: var(--hover-bg, #fafafa); }
.search-item__thumb {
    flex-shrink: 0;
    width: 180px;
    overflow: hidden;
    background: #1a1a1a;
}
.search-item__thumb img {
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .3s;
}
.search-item:hover .search-item__thumb img { transform: scale(1.04); }
.search-item__body {
    flex: 1; min-width: 0;
    padding: 18px 22px;
    display: flex; flex-direction: column; gap: 8px;
}
.search-item__cats { display: flex; flex-wrap: wrap; gap: 5px; }
.search-item__cats a {
    background: var(--brand-red, #DD3333);
    color: #fff; font-size: 10px; text-transform: uppercase;
    letter-spacing: .05em; font-weight: 700;
    padding: 2px 8px; border-radius: 2px;
    text-decoration: none;
}
.search-item__cats a:hover { background: #b91c1c; }
.search-item__title {
    margin: 0;
    font-size: 1.1rem; font-weight: 700;
    color: var(--heading, #111);
    line-height: 1.3;
}
.search-item__title a { color: inherit; text-decoration: none; }
.search-item__title a:hover { color: var(--brand-red, #DD3333); }
.search-item__meta {
    display: flex; flex-wrap: wrap; gap: 12px;
    color: var(--muted, #888); font-size: 12px;
}
.search-item__meta i { margin-right: 3px; }
.search-item__excerpt {
    color: var(--text, #444); font-size: .9rem;
    line-height: 1.55;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.search-no-results { color: var(--muted, #888); font-size: .95rem; }
@media (max-width: 600px) {
    .search-item__thumb { width: 110px; }
    .search-item__body { padding: 12px 14px; }
    .search-item__title { font-size: 1rem; }
}

/* ----- Pagination ----- */
.pagination {
    display: flex; gap: 4px; flex-wrap: wrap;
    justify-content: center;
    margin-top: 28px;
    padding: 16px 0;
}
.pagination a, .pagination span, .pagination button {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 38px; height: 38px;
    padding: 0 14px;
    border-radius: 3px;
    background: #fff;
    border: 1px solid #c8c8c8;
    color: #555;
    font-weight: 600;
    font-size: inherit;
    font-family: inherit;
    text-decoration: none;
    cursor: pointer;
    transition: background .15s, color .15s, border-color .15s;
}
.pagination a:hover, .pagination button:hover { background: var(--brand-red, #DD3333); border-color: var(--brand-red, #DD3333); color: #fff; }
.pagination .pagination__current { background: var(--brand-red, #DD3333); border-color: var(--brand-red, #DD3333); color: #fff; cursor: default; }
.pagination .pagination__disabled { opacity: .4; cursor: default; pointer-events: none; }

/* ----- Pagination toolbar (per-page + info + nav) ----- */
.pagination-toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px 20px;
    margin-top: 24px;
    justify-content: center;
}
.pagination-toolbar .pagination { margin-top: 0; padding: 0; }
.per-page-wrap { display: flex; align-items: center; gap: 0; }
.per-page-label { display: flex; align-items: center; gap: 8px; font-size: .875rem; color: var(--text-muted, #666); cursor: default; }
.per-page-select {
    padding: 5px 28px 5px 10px;
    border: 1px solid #c8c8c8;
    border-radius: 3px;
    background: #fff;
    font-size: .875rem;
    cursor: pointer;
    appearance: auto;
}
.per-page-select:focus { outline: 2px solid var(--brand-red, #DD3333); outline-offset: 1px; }
.pagination-info { font-size: .875rem; color: var(--text-muted, #666); white-space: nowrap; }

/* ----- Widgets generic (kept for compat; sidebar overrides above) ----- */
.widget {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.1rem 1.2rem 1.2rem;
}
.widget__title {
    font-size: .9rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--heading);
    margin: 0 0 .85rem;
    font-weight: 800;
}
.widget__lead { font-size: .9rem; margin-bottom: .8rem; color: var(--muted); }
.widget__big {
    font-size: 2rem; font-weight: 800;
    color: var(--accent);
    margin: 0;
    font-variant-numeric: tabular-nums;
}
.widget__sub { color: var(--muted); margin: 0; font-size: .85rem; }
.widget__select { width: 100%; }

.newsletter-form input[type="email"] { margin-bottom: 8px; }
.newsletter-form button { width: 100%; justify-content: center; }
.newsletter-form__note  { font-size: 12px; margin: 8px 0 0; text-align: center; color: #aaa; }
.newsletter-form__msg   { font-size: 13px; margin: 6px 0 0; min-height: 1.2em; }
.newsletter-form__msg.ok    { color: #6ee07a; }
.newsletter-form__msg.error { color: #ff8a85; }

.cat-tree ul { list-style: none; padding-left: 0; margin: 0; }
.cat-tree li { padding: 4px 0; font-size: 14px; line-height: 1.4; }
.cat-tree li ul { padding-left: 14px; margin-top: 4px; }
.cat-tree a { display: inline-flex; justify-content: space-between; gap: 8px; width: 100%; }
.cat-tree__count {
    font-size: 12px;
    padding: 0 7px;
    border-radius: 999px;
    min-width: 22px;
    text-align: center;
}

.recent-list { list-style: none; padding: 0; margin: 0; }
.recent-list li { padding: 8px 0; border-top: 1px solid; font-size: 13px; line-height: 1.4; }
.recent-list li:first-child { border-top: 0; padding-top: 0; }
.recent-list time { font-size: 12px; display: block; margin-top: 2px; }

/* ----- Alerts ----- */
.alert {
    border-left: 4px solid;
    border-radius: 8px;
    padding: .85rem 1rem .85rem 3rem;
    margin: 1.25rem 0;
    position: relative;
}
.alert::before {
    font-family: 'bootstrap-icons';
    font-size: 1.25rem;
    line-height: 1.3;
    position: absolute;
    left: .9rem;
    top: .8rem;
}
.alert-warning { background: var(--alert-warning-bg); border-color: var(--alert-warning-bd); color: var(--alert-warning-fg); }
.alert-warning::before { content: "\f33a"; }
.alert-danger  { background: var(--alert-danger-bg);  border-color: var(--alert-danger-bd);  color: var(--alert-danger-fg); }
.alert-danger::before  { content: "\f622"; }
.alert-purple  { background: var(--alert-purple-bg);  border-color: var(--alert-purple-bd);  color: var(--alert-purple-fg); }
.alert-purple::before  { content: "\f470"; }
.alert-success { background: var(--alert-success-bg); border-color: var(--alert-success-bd); color: var(--alert-success-fg); }
.alert-success::before { content: "\f26b"; }
.alert-info    { background: var(--alert-info-bg);    border-color: var(--alert-info-bd);    color: var(--alert-info-fg); }
.alert-info::before    { content: "\f431"; }
.alert > * { margin: 0; }

/* ----- Lightbox ----- */
.zoomable {
    position: relative;
    cursor: zoom-in;
    margin: 1.5rem auto;
    max-width: 100%;
}
.zoomable img {
    border-radius: 6px;
    border: 1px solid var(--border);
    transition: transform .2s;
}
.zoomable:hover img { transform: scale(1.01); }
.zoomable figcaption {
    color: var(--muted);
    font-size: .85rem;
    text-align: center;
    margin-top: .5rem;
}

dialog.lightbox {
    border: 0;
    background: transparent;
    padding: 0;
    width: 100vw;
    height: 100vh;
    max-width: 100vw;
    max-height: 100vh;
    overflow: hidden;
    /* estado fechado para transicao */
    opacity: 0;
    transition: opacity .25s ease, overlay .25s ease allow-discrete, display .25s ease allow-discrete;
}
dialog.lightbox[open] {
    opacity: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}
@starting-style {
    dialog.lightbox[open] { opacity: 0; }
}
dialog.lightbox::backdrop {
    background: rgba(0, 0, 0, .92);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    opacity: 0;
    transition: opacity .25s ease, backdrop-filter .25s ease;
}
dialog.lightbox[open]::backdrop { opacity: 1; }
@starting-style {
    dialog.lightbox[open]::backdrop { opacity: 0; }
}

.lightbox__img {
    /* Ocupa o maximo do viewport mantendo aspect-ratio (sem ultrapassar 100%).
       width/height fixos + object-fit:contain garantem upscaling de imagens
       pequenas ate preencher a area, mantendo proporcao. */
    width: 96vw;
    height: 96vh;
    object-fit: contain;
    border-radius: 8px;
    filter: drop-shadow(0 30px 60px rgba(0,0,0,.5));
    cursor: zoom-out;
    animation: lightboxZoomIn .35s cubic-bezier(.2,.85,.3,1.1) both;
}
@keyframes lightboxZoomIn {
    0%   { opacity: 0; transform: scale(.85); filter: blur(6px); }
    60%  { opacity: 1; filter: blur(0); }
    100% { opacity: 1; transform: scale(1); filter: blur(0); }
}
.lightbox.is-closing .lightbox__img {
    animation: lightboxZoomOut .2s ease both;
}
@keyframes lightboxZoomOut {
    from { opacity: 1; transform: scale(1); }
    to   { opacity: 0; transform: scale(.9); }
}

.lightbox__close {
    position: fixed;
    top: 1rem; right: 1rem;
    background: rgba(255,255,255,.12);
    color: #fff;
    border: 0;
    width: 44px; height: 44px;
    border-radius: 50%;
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
    transition: background .15s, transform .15s;
}
.lightbox__close:hover { background: rgba(255,255,255,.25); transform: rotate(90deg); }

.lightbox__prev,
.lightbox__next {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,.12);
    color: #fff;
    border: 0;
    width: 52px; height: 52px;
    border-radius: 50%;
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
    transition: background .15s, transform .15s;
    display: flex; align-items: center; justify-content: center;
    z-index: 10;
}
.lightbox__prev { left: 1rem; transform: translateY(-50%); }
.lightbox__next { right: 1rem; transform: translateY(-50%); }
.lightbox__prev:hover { background: rgba(255,255,255,.25); transform: translateY(-50%) scale(1.1); }
.lightbox__next:hover { background: rgba(255,255,255,.25); transform: translateY(-50%) scale(1.1); }

@media (prefers-reduced-motion: reduce) {
    .lightbox__img,
    .lightbox.is-closing .lightbox__img,
    dialog.lightbox,
    dialog.lightbox::backdrop { animation: none !important; transition: none !important; }
}

/* ----- Video embed ----- */
.video-embed {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    margin: 1.5rem 0;
    border-radius: 8px;
    overflow: hidden;
    background: #000;
}
.video-embed iframe {
    position: absolute; inset: 0;
    width: 100%; height: 100%;
    border: 0;
}

/* ----- Carousel relacionados ----- */
.related {
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid #c8c8c8;
}
.related h2 { margin-top: 0; color: #333; }
.related__viewport {
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}
.related__track {
    display: flex; gap: 1rem;
    padding-bottom: 1rem;
}
.related__slide {
    flex: 0 0 280px;
    scroll-snap-align: start;
    background: #fff;
    border: 1px solid #c8c8c8;
    overflow: hidden;
    transition: transform .15s, border-color .15s;
    color: #333;
}
.related__slide:hover { transform: translateY(-3px); border-color: var(--brand-red, #DD3333); text-decoration: none; }
.related__slide img {
    width: 100%; aspect-ratio: 16 / 9; object-fit: cover;
    background: #eee;
}
.related__slide-body { padding: .75rem 1rem 1rem; }
.related__slide-body h3 {
    font-size: 15px; margin: 0 0 .35rem;
    color: #333;
    font-weight: 600;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.related__slide-body time { color: #888; font-size: 12px; }

.related__nav {
    display: flex; gap: .5rem; justify-content: end;
    margin-bottom: .75rem;
}
.related__nav button {
    width: 38px; height: 38px;
    border-radius: 50%;
    border: 1px solid #c8c8c8;
    background: #fff;
    color: #555;
}
.related__nav button:hover { background: var(--brand-red, #DD3333); color: #fff; border-color: var(--brand-red, #DD3333); }
.related__nav button:disabled { opacity: .35; cursor: not-allowed; }


