:root {
    --hub-bg: #F4F1EA;
    --hub-surface: #fffdfa;
    --hub-border: rgba(200, 168, 107, 0.24);
    --hub-text: #0F2233;
    --hub-muted: #5d6a75;
    --hub-primary: #18354D;
    --hub-primary-strong: #0F2233;
    --hub-accent: #C8A86B;
    --hub-success: #0f766e;
    --hub-shadow: 0 16px 34px rgba(15, 34, 51, 0.1);
}

.ferramentas-page.hub-page {
    max-width: 1180px;
    margin: 0 auto;
    padding: 7.5rem 1rem 3rem;
    color: var(--hub-text);
}

body.hub-js .hub-reveal {
    opacity: 0;
    transform: translateY(14px);
    transition: opacity 0.45s ease, transform 0.45s ease;
}

body.hub-js .hub-reveal.is-revealed {
    opacity: 1;
    transform: translateY(0);
}

.hub-hero {
    position: relative;
    overflow: hidden;
    border-radius: 24px;
    padding: 1.3rem;
    background:
        radial-gradient(circle at 12% 18%, rgba(200, 168, 107, 0.25), transparent 40%),
        radial-gradient(circle at 88% 22%, rgba(24, 53, 77, 0.22), transparent 35%),
        linear-gradient(140deg, #0F2233 0%, #18354D 58%, #244A69 100%);
    color: #ffffff;
}

.hub-kicker {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    background: rgba(255, 255, 255, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.35);
}

.hub-hero h1 {
    margin-top: 0.85rem;
    margin-bottom: 0.7rem;
    font-size: clamp(1.45rem, 2vw + 1rem, 2.25rem);
    line-height: 1.15;
}

.hub-hero p {
    margin: 0;
    max-width: 62ch;
    color: rgba(255, 255, 255, 0.92);
}

.hub-hero-actions {
    margin-top: 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
}

.hub-overview {
    margin-top: 1rem;
    display: grid;
    gap: 0.8rem;
}

.hub-overview-card {
    background: linear-gradient(180deg, #ffffff 0%, #fcfaf5 100%);
    border: 1px solid var(--hub-border);
    border-radius: 18px;
    padding: 0.95rem 1rem;
    box-shadow: 0 12px 24px rgba(15, 34, 51, 0.08);
}

.hub-overview-value {
    display: block;
    font-size: clamp(1.65rem, 3vw, 2.35rem);
    font-weight: 800;
    line-height: 1;
    color: var(--hub-primary-strong);
}

.hub-overview-label {
    display: block;
    margin-top: 0.3rem;
    color: var(--hub-muted);
    font-weight: 600;
}

.hub-overview-card--wide {
    background:
        radial-gradient(circle at 85% 20%, rgba(200, 168, 107, 0.14), transparent 28%),
        linear-gradient(145deg, #ffffff 0%, #f8f3ea 100%);
}

.hub-overview-eyebrow {
    margin: 0;
    font-size: 0.8rem;
    font-weight: 800;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: #42576a;
}

.hub-pill-links {
    margin-top: 0.7rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
}

.hub-pill-links a {
    text-decoration: none;
    color: var(--hub-primary-strong);
    background: #f5efe5;
    border: 1px solid rgba(200, 168, 107, 0.24);
    border-radius: 999px;
    padding: 0.48rem 0.78rem;
    font-weight: 700;
    transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.hub-pill-links a:hover {
    background: #efe6d7;
    border-color: rgba(200, 168, 107, 0.34);
    transform: translateY(-1px);
}

.hub-btn {
    appearance: none;
    border: none;
    text-decoration: none;
    cursor: pointer;
    border-radius: 12px;
    font-weight: 700;
    line-height: 1;
    padding: 0.75rem 1rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.hub-btn:focus-visible {
    outline: 2px solid #ffffff;
    outline-offset: 2px;
}

.hub-btn-primary {
    color: #111111;
    background: linear-gradient(135deg, #dfc392 0%, #C8A86B 100%);
}

.hub-btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.18);
}

.hub-btn-ghost {
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.45);
    background: rgba(255, 255, 255, 0.12);
}

.hub-btn-ghost:hover {
    background: rgba(255, 255, 255, 0.2);
}

.hub-toolbar {
    margin-top: 1rem;
    background: var(--hub-surface);
    border: 1px solid var(--hub-border);
    border-radius: 20px;
    padding: 0.95rem;
    box-shadow: var(--hub-shadow);
    transition: border-color 0.28s ease, box-shadow 0.28s ease, background-color 0.28s ease;
}

.hub-toolbar.is-search-focus {
    border-color: rgba(200, 168, 107, 0.42);
    box-shadow: 0 14px 28px rgba(15, 34, 51, 0.14);
}

.hub-toolbar.is-searching {
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.hub-search-wrap {
    position: relative;
}

.hub-search-wrap i {
    position: absolute;
    left: 0.8rem;
    top: 50%;
    transform: translateY(-50%);
    color: #697684;
}

.hub-search-input {
    width: 100%;
    border: 1px solid rgba(200, 168, 107, 0.22);
    border-radius: 12px;
    background: #fffcf8;
    padding: 0.8rem 0.8rem 0.8rem 2.35rem;
    font-size: 1rem;
    color: var(--hub-primary-strong);
}

.hub-search-input:focus {
    outline: 2px solid rgba(200, 168, 107, 0.18);
    border-color: rgba(200, 168, 107, 0.4);
}

.hub-filters {
    display: flex;
    gap: 0.55rem;
    overflow-x: auto;
    padding: 0.75rem 0.05rem 0.1rem;
    scrollbar-width: thin;
}

.hub-filter-btn {
    white-space: nowrap;
    border: 1px solid rgba(200, 168, 107, 0.22);
    background: #faf5ed;
    color: #2d4458;
    border-radius: 999px;
    padding: 0.48rem 0.9rem;
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.hub-filter-btn.active {
    color: #ffffff;
    border-color: transparent;
    background: linear-gradient(120deg, #18354D, #0F2233);
    box-shadow: 0 7px 16px rgba(15, 34, 51, 0.28);
}

.hub-filter-btn:active {
    transform: translateY(1px);
}

.hub-results-info {
    margin: 0.75rem 0 0;
    color: var(--hub-muted);
    font-size: 0.9rem;
}

.hub-section {
    margin-top: 1.15rem;
}

.hub-section-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-end;
    gap: 0.6rem;
    margin-bottom: 0.75rem;
}

.hub-section-header h2 {
    margin: 0;
    font-size: clamp(1.1rem, 1.6vw + 0.7rem, 1.6rem);
}

.hub-section-header p {
    margin: 0;
    color: var(--hub-muted);
}

.hub-grid {
    display: grid;
    gap: 0.85rem;
}

.hub-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    background: var(--hub-surface);
    border: 1px solid var(--hub-border);
    border-radius: 18px;
    padding: 0.95rem;
    box-shadow: 0 7px 16px rgba(8, 43, 73, 0.08);
    transition: transform 0.24s ease, box-shadow 0.24s ease, border-color 0.24s ease;
}

.hub-card.is-hidden {
    display: none;
}

body.hub-js .hub-card.is-filtered-in {
    animation: hubCardIn 0.34s ease both;
    animation-delay: var(--hub-enter-delay, 0ms);
}

.hub-card.is-favorite {
    border-color: #f0b278;
    box-shadow: 0 10px 24px rgba(212, 109, 19, 0.2);
}

.hub-card--featured {
    background:
        radial-gradient(circle at 100% 0%, rgba(24, 53, 77, 0.08), transparent 30%),
        linear-gradient(180deg, #ffffff 0%, #fcfaf5 100%);
}

.hub-card--featured::before {
    content: '';
    position: absolute;
    inset: 0 auto 0 0;
    width: 4px;
    border-radius: 18px 0 0 18px;
    background: linear-gradient(180deg, #C8A86B, #18354D);
}

.hub-card:hover {
    transform: translateY(-2px);
    border-color: rgba(200, 168, 107, 0.34);
    box-shadow: 0 16px 30px rgba(15, 34, 51, 0.13);
}

.hub-card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.8rem;
}

.hub-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: #f6efe4;
    color: var(--hub-primary-strong);
    font-size: 1.1rem;
}

.hub-badges {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.hub-badge {
    font-size: 0.72rem;
    font-weight: 700;
    border-radius: 999px;
    padding: 0.28rem 0.58rem;
    border: 1px solid rgba(200, 168, 107, 0.2);
    color: #42576a;
    background: #faf5ed;
}

.hub-badge--law {
    color: #315a54;
    background: #eef7f3;
    border-color: #c5ddd5;
}

.hub-badge--new {
    color: #7a6240;
    background: #fbf4e8;
    border-color: rgba(200, 168, 107, 0.28);
}

.hub-card h3 {
    margin: 0;
    font-size: 1.02rem;
}

.hub-card p {
    margin: 0;
    color: var(--hub-muted);
}

.hub-card-actions {
    margin-top: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
}

.hub-link {
    text-decoration: none;
    font-weight: 700;
    color: #ffffff;
    background: linear-gradient(120deg, #18354D, #0F2233);
    padding: 0.62rem 0.9rem;
    border-radius: 10px;
}

.hub-link:hover {
    filter: brightness(1.06);
}

.hub-fav-btn {
    border: 1px solid rgba(200, 168, 107, 0.2);
    background: #fdf9f2;
    color: #6b7783;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    cursor: pointer;
}

.hub-fav-btn.is-pulsing {
    animation: hubFavPulse 0.3s ease;
}

.hub-fav-btn[aria-pressed="true"] {
    color: #C8A86B;
    border-color: rgba(200, 168, 107, 0.34);
    background: #fbf4e8;
}

.hub-resources {
    display: grid;
    gap: 0.8rem;
}

.hub-resource-group {
    background: #ffffff;
    border: 1px solid rgba(200, 168, 107, 0.22);
    border-radius: 14px;
    padding: 0.8rem;
}

.hub-resource-group h3 {
    margin: 0;
    font-size: 0.96rem;
}

.hub-resource-list {
    margin-top: 0.65rem;
    display: grid;
    gap: 0.5rem;
}

.hub-resource-item {
    display: flex;
    gap: 0.55rem;
    align-items: center;
    text-decoration: none;
    color: var(--hub-primary-strong);
    border: 1px solid rgba(200, 168, 107, 0.22);
    background: #fffaf3;
    border-radius: 10px;
    padding: 0.62rem 0.7rem;
    font-weight: 600;
}

.hub-resource-item:hover {
    border-color: rgba(200, 168, 107, 0.34);
    background: #f7efe3;
}

.hub-section-cta {
    margin-top: 1.1rem;
    border-radius: 22px;
    padding: 1.1rem;
    background: linear-gradient(135deg, #0F2233 0%, #18354D 55%, #234865 100%);
    color: #ffffff;
}

.hub-section-cta h2 {
    margin-top: 0;
}

.hub-section-cta p {
    margin-bottom: 0;
    color: rgba(255, 255, 255, 0.9);
}

.hub-section-cta .hub-hero-actions {
    margin-top: 0.9rem;
}

@media (min-width: 760px) {
    .ferramentas-page.hub-page {
        padding: 7.7rem 1.2rem 3.2rem;
    }

    .hub-hero {
        padding: 1.7rem;
    }

    .hub-toolbar {
        padding: 1.15rem;
    }

    .hub-overview {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .hub-overview-card--wide {
        grid-column: 1 / -1;
    }

    .hub-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .hub-resources {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 768px) {
    .ferramentas-page.hub-page {
        padding-top: 6rem;
    }
}

@media (min-width: 1050px) {
    .hub-overview {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .hub-overview-card--wide {
        grid-column: span 1;
    }

    .hub-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .hub-hero {
        padding: 2rem;
    }
}

@keyframes hubCardIn {
    from {
        opacity: 0;
        transform: translateY(9px) scale(0.992);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes hubFavPulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.08);
    }
    100% {
        transform: scale(1);
    }
}

@media (prefers-reduced-motion: reduce) {
    body.hub-js .hub-reveal {
        opacity: 1;
        transform: none;
        transition: none;
    }

    body.hub-js .hub-card.is-filtered-in {
        animation: none;
    }
}
