/* =========================================================
   ETAPA 18 — ACABAMENTO VISUAL FINAL
   Carregado por último para preservar as etapas anteriores.
   ========================================================= */

:root {
    --final-shadow: 0 8px 30px rgba(0,0,0,.08);
    --final-shadow-hover: 0 14px 36px rgba(0,0,0,.13);
    --final-radius: 18px;
}

body {
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

button,
input,
select,
textarea {
    font: inherit;
}

img {
    max-width: 100%;
}

.skip-link {
    position: fixed;
    top: 8px;
    left: 8px;
    z-index: 9999;
    padding: 10px 14px;
    border-radius: 10px;
    background: #111;
    color: #fff;
    font-weight: 800;
    transform: translateY(-150%);
}

.skip-link:focus {
    transform: translateY(0);
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
summary:focus-visible {
    outline: 3px solid rgba(230,0,35,.32);
    outline-offset: 3px;
}

/* Cabeçalho */
.topbar {
    box-shadow: 0 1px 12px rgba(0,0,0,.035);
    backdrop-filter: blur(12px);
}

.logo {
    letter-spacing: -.2px;
}

.logo-mark {
    box-shadow: 0 4px 14px rgba(230,0,35,.2);
}

.search {
    border: 1px solid transparent;
    transition: border-color .18s ease, background .18s ease, box-shadow .18s ease;
}

.search:focus-within {
    background: #fff;
    border-color: #d9d9d9;
    box-shadow: 0 0 0 4px rgba(0,0,0,.035);
}

.nav-link,
.btn-primary,
.category-chip {
    transition: transform .16s ease, background .16s ease, color .16s ease, border-color .16s ease;
}

.btn-primary:hover {
    transform: translateY(-1px);
}

/* Menu móvel sem JavaScript */
.mobile-menu {
    display: none;
    position: relative;
    margin-left: auto;
}

.mobile-menu summary {
    list-style: none;
    padding: 10px 14px;
    border: 1px solid #e3e3e3;
    border-radius: 22px;
    background: #fff;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
}

.mobile-menu summary::-webkit-details-marker {
    display: none;
}

.mobile-menu-panel {
    position: absolute;
    top: calc(100% + 9px);
    right: 0;
    z-index: 100;
    display: grid;
    min-width: 210px;
    padding: 8px;
    border: 1px solid #e5e5e5;
    border-radius: 15px;
    background: #fff;
    box-shadow: 0 16px 42px rgba(0,0,0,.14);
}

.mobile-menu-panel a {
    padding: 11px 12px;
    border-radius: 9px;
    font-size: 13px;
    font-weight: 700;
}

.mobile-menu-panel a:hover {
    background: #f4f4f4;
}

/* Página inicial */
.hero {
    position: relative;
    padding-top: clamp(42px, 6vw, 72px);
}

.hero h1 {
    text-wrap: balance;
}

.hero-text {
    text-wrap: pretty;
}

.categories {
    scroll-snap-type: x proximity;
}

.category-chip {
    scroll-snap-align: start;
}

.section-heading {
    padding-top: 6px;
}

.card {
    border: 1px solid rgba(0,0,0,.045);
    box-shadow: var(--final-shadow);
}

.card:hover {
    box-shadow: var(--final-shadow-hover);
}

.card-image {
    transition: transform .25s ease;
}

.card:hover .card-image {
    transform: scale(1.012);
}

.card-image-link {
    overflow: hidden;
}

.card h3 {
    letter-spacing: -.15px;
}

.author-link {
    color: #555;
}

.author-link:hover {
    color: #111;
}

.footer {
    flex-wrap: wrap;
    align-items: center;
}

.footer-top {
    margin-left: 8px;
    font-weight: 800;
}

.footer-top:hover {
    color: #111;
}

/* Página da atividade */
.activity-preview {
    border: 1px solid rgba(0,0,0,.05);
}

.activity-info h1 {
    text-wrap: balance;
}

.etapa15-author {
    border-radius: 12px;
    padding-left: 8px;
    padding-right: 8px;
    transition: background .16s ease;
}

.etapa15-author:hover {
    background: #fafafa;
}

.etapa15-button,
.download-button,
.share-button {
    transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}

.etapa15-button:hover,
.download-button:hover,
.share-button:hover {
    transform: translateY(-1px);
}

.download-button {
    box-shadow: 0 5px 16px rgba(230,0,35,.15);
}

.share-box {
    background: #fbfbfb;
}

.floating-top {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 30;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border: 1px solid #e5e5e5;
    border-radius: 50%;
    background: rgba(255,255,255,.95);
    box-shadow: 0 8px 24px rgba(0,0,0,.12);
    font-weight: 900;
}

/* Minha área */
.portal-link-card {
    min-height: 92px;
}

.portal-link-card strong {
    font-size: 15px;
}

/* Tablet */
@media (max-width: 900px) {
    .topbar {
        gap: 12px;
    }

    .nav-actions {
        gap: 9px;
    }

    .nav-link {
        font-size: 13px;
    }
}

/* Celular */
@media (max-width: 700px) {
    .topbar {
        align-items: center;
        padding: 10px 12px;
    }

    .logo {
        min-width: 0;
        max-width: calc(100% - 82px);
    }

    .logo span:last-child {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .topbar > .nav-actions {
        display: none;
    }

    .mobile-menu {
        display: block;
    }

    .search {
        order: 3;
        flex-basis: 100%;
        height: 44px;
    }

    .search button {
        display: block;
        padding: 0 13px;
        font-size: 12px;
    }

    .hero {
        padding-top: 34px;
    }

    .hero h1 {
        font-size: clamp(31px, 10vw, 43px);
        line-height: 1.04;
    }

    .categories {
        margin-left: -2px;
        padding-bottom: 22px;
    }

    .section-heading {
        align-items: flex-start;
    }

    .count {
        padding-top: 5px;
    }

    .card {
        box-shadow: 0 3px 14px rgba(0,0,0,.08);
    }

    .activity-layout {
        gap: 24px;
    }

    .activity-info h1 {
        font-size: clamp(30px, 9vw, 38px);
    }

    .stats {
        gap: 10px 14px;
    }

    .floating-top {
        right: 14px;
        bottom: 14px;
    }
}

@media (max-width: 420px) {
    /* Mantém uma coluna em telas realmente estreitas. */
    .masonry {
        columns: 1;
    }

    .section-heading {
        flex-direction: column;
        gap: 5px;
    }

    .search-icon {
        padding-left: 13px;
    }

    .search input {
        min-width: 0;
    }

    .share-actions {
        display: grid;
        grid-template-columns: 1fr;
    }
}

/* Respeita usuários que preferem menos animação. */
@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        transition-duration: .01ms !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
    }
}
