/* ================================================
   Portal Municipal do Bungo — Custom Styles
   ================================================ */

/* ============================================
   CSS Custom Properties (Design Tokens)
   ============================================ */
:root {
    --color-primary: #B91C1C;
    --color-primary-light: #DC2626;
    --color-secondary: #EAB308;
    --color-secondary-light: #FACC15;
    --color-accent: #0F172A;
    --color-cta: #0369A1;
    --color-dark: #0F172A;
    --color-light: #F8FAFC;
    --color-success: #15803D;
    --font-heading: 'Poppins', sans-serif;
    --font-body: 'Inter', sans-serif;
    --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-md: 0 4px 16px rgba(15, 23, 42, 0.08), 0 2px 4px rgba(15, 23, 42, 0.04);
    --shadow-lg: 0 12px 40px rgba(15, 23, 42, 0.12), 0 4px 12px rgba(15, 23, 42, 0.06);
    --shadow-xl: 0 24px 60px rgba(15, 23, 42, 0.16), 0 8px 20px rgba(15, 23, 42, 0.08);
    --radius-sm: 0.5rem;
    --radius-md: 0.75rem;
    --radius-lg: 1rem;
    --radius-xl: 1.5rem;
    --radius-full: 9999px;
    /* 3D System */
    --perspective: 1000px;
    --tilt-transition: transform 0.15s ease, box-shadow 0.15s ease;
}

/* ============================================
   Base Styles
   ============================================ */
html {
    scroll-behavior: smooth;
    font-size: 17px;
}

body {
    font-family: var(--font-body);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

::selection {
    background-color: var(--color-secondary);
    color: var(--color-accent);
}

/* ============================================
   Focus States for Accessibility
   ============================================ */
:focus-visible {
    outline: 3px solid var(--color-cta);
    outline-offset: 3px;
    border-radius: 4px;
}

/* ============================================
   Skip to Content Link
   ============================================ */
.skip-to-content {
    position: fixed;
    top: -100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 1rem 2rem;
    background: var(--color-cta);
    color: white;
    font-weight: 600;
    border-radius: var(--radius-full);
    z-index: 9999;
    transition: top var(--transition-normal);
}

.skip-to-content:focus {
    top: 1rem;
}

/* ============================================
   Scroll Progress Bar
   ============================================ */
.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--color-primary), var(--color-secondary), var(--color-primary));
    background-size: 200% 100%;
    animation: shimmer-progress 3s ease-in-out infinite;
    z-index: 9999;
    transition: width 0.15s linear;
}

@keyframes shimmer-progress {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ============================================
   Custom Scrollbar
   ============================================ */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(to bottom, var(--color-primary), var(--color-secondary));
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-primary);
}

/* ============================================
   Navigation Styles
   ============================================ */
.navbar-scrolled {
    background: rgba(255, 255, 255, 0.92) !important;
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid rgba(15, 23, 42, 0.06) !important;
    box-shadow: 0 1px 20px rgba(15, 23, 42, 0.06);
}

.nav-link {
    position: relative;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 50%;
    transform: translateX(-50%) scaleX(0);
    width: 100%;
    height: 2px;
    background: var(--color-primary);
    transition: transform var(--transition-normal);
    transform-origin: center;
    border-radius: 1px;
}

.nav-link:hover::after,
.nav-link.active::after {
    transform: translateX(-50%) scaleX(1);
}

/* ============================================
   Button Styles (Light Mode)
   ============================================ */
.btn-primary {
    background: var(--color-primary);
    color: white;
    padding: 0.875rem 2rem;
    border-radius: var(--radius-full);
    font-weight: 600;
    transition: all var(--transition-normal);
    box-shadow: 0 4px 14px rgba(185, 28, 28, 0.25);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(185, 28, 28, 0.35);
    background: var(--color-primary-light);
}

.btn-secondary {
    background: transparent;
    border: 2px solid var(--color-primary);
    color: var(--color-primary);
    padding: 0.875rem 2rem;
    border-radius: var(--radius-full);
    font-weight: 600;
    transition: all var(--transition-normal);
}

.btn-secondary:hover {
    background: var(--color-primary);
    color: white;
}

/* ============================================
   Card Styles (Light Mode)
   ============================================ */
.card-gov {
    background: white;
    border: 1px solid rgba(15, 23, 42, 0.06);
    border-radius: var(--radius-xl);
    padding: 2rem;
    transition: all var(--transition-normal);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
}

.card-gov:hover {
    border-color: rgba(185, 28, 28, 0.2);
    box-shadow: var(--shadow-lg);
    transform: translateY(-4px);
}

/* ============================================
   Form Styles (Light Mode)
   ============================================ */
.form-input,
.form-textarea,
.form-select {
    width: 100%;
    background: var(--color-light);
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-md);
    padding: 1rem 1.25rem;
    color: var(--color-dark);
    font-family: var(--font-body);
    font-size: 1rem;
    transition: all var(--transition-normal);
}

.form-input::placeholder,
.form-textarea::placeholder {
    color: #94a3b8;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 4px rgba(185, 28, 28, 0.08);
    background: white;
}

/* ============================================
   Toast Notification
   ============================================ */
.toast {
    animation: toast-slide-in 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes toast-slide-in {
    from {
        opacity: 0;
        transform: translateX(40px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

/* ============================================
   Loading Spinner
   ============================================ */
.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(185, 28, 28, 0.15);
    border-radius: 50%;
    border-top-color: var(--color-primary);
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ============================================
   Swiper Customization
   ============================================ */
.swiper-pagination-bullet {
    background: #cbd5e1;
    opacity: 1;
    width: 10px;
    height: 10px;
    transition: all var(--transition-normal);
}

.swiper-pagination-bullet-active {
    background: var(--color-primary);
    width: 28px;
    border-radius: 5px;
}

/* ============================================
   Smooth Animations
   ============================================ */
.fade-in {
    animation: fadeIn 0.7s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.slide-up {
    animation: slideUp 0.7s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.scale-in {
    animation: scaleIn 0.7s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.92);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* ============================================
   Gentle Floating Animation
   ============================================ */
.float-gentle {
    animation: floatGentle 8s ease-in-out infinite;
}

@keyframes floatGentle {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-12px); }
}

/* ============================================
   Orb Breathing Animation (replaces pulse)
   ============================================ */
.orb-breathe {
    animation: orbBreathe 6s ease-in-out infinite;
}

.orb-breathe-delay {
    animation: orbBreathe 6s ease-in-out infinite;
    animation-delay: 3s;
}

@keyframes orbBreathe {
    0%, 100% { opacity: 0.4; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(1.08); }
}

/* ============================================
   Gradient Text (Light Mode)
   ============================================ */
.gradient-text {
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.gradient-text-gold {
    background: linear-gradient(135deg, var(--color-secondary), #F59E0B);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ============================================
   Glass Effect (Light Mode)
   ============================================ */
.glass-light {
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.6);
}

/* ============================================
   Decorative Divider
   ============================================ */
.section-divider {
    width: 60px;
    height: 4px;
    background: linear-gradient(90deg, var(--color-primary), var(--color-secondary));
    border-radius: 2px;
    margin: 0 auto;
}

/* ============================================
   Stat Counter Glow
   ============================================ */
.stat-number {
    position: relative;
    display: inline-block;
}

.stat-number::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 3px;
    background: linear-gradient(90deg, var(--color-primary), var(--color-secondary));
    border-radius: 2px;
    opacity: 0.6;
}

/* ============================================
   Service Card Ribbon
   ============================================ */
.card-ribbon {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, var(--color-primary), var(--color-secondary));
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.group:hover .card-ribbon {
    opacity: 1;
}

/* ============================================
   Image Hover Zoom
   ============================================ */
.img-zoom {
    overflow: hidden;
}

.img-zoom img {
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.img-zoom:hover img {
    transform: scale(1.05);
}

/* ============================================
   FAQ Accordion Smooth
   ============================================ */
.faq-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), padding 0.4s ease;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
}

.faq-content.open {
    max-height: 300px;
    padding-top: 0.5rem !important;
    padding-bottom: 1.5rem !important;
}

.faq-toggle i {
    transition: transform var(--transition-normal);
}

/* ============================================
   CTA Section Background Pattern
   ============================================ */
.pattern-dots {
    background-image: radial-gradient(circle, rgba(185, 28, 28, 0.06) 1px, transparent 1px);
    background-size: 24px 24px;
}

/* ============================================
   Line Clamp
   ============================================ */
.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ============================================
   Responsive Utilities
   ============================================ */
@media (max-width: 768px) {
    html {
        font-size: 16px;
    }

    .hero-title {
        font-size: 2.5rem;
    }

    .section-title {
        font-size: 2rem;
    }
}

/* ============================================
   Reduced Motion Preference
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    .orb-breathe,
    .orb-breathe-delay,
    .float-gentle {
        animation: none !important;
    }
}

/* ============================================
   Print Styles
   ============================================ */
@media print {
    .navbar,
    .footer,
    .scroll-progress,
    #scrollTop {
        display: none !important;
    }

    body {
        background: white;
        color: black;
    }
}

/* ============================================================
   3D SYSTEM — Vanta Hero Container
   ============================================================ */
.vanta-hero {
    position: relative;
    min-height: 520px;
    background: #ffffff;
    overflow: hidden;
}

.vanta-hero canvas {
    position: absolute !important;
    inset: 0;
    z-index: 0;
}

.vanta-hero .hero-content {
    position: relative;
    z-index: 2;
}

/* ── Hero background fallback (mobile) ── */
.vanta-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 70% 30%, rgba(185,28,28,0.06) 0%, transparent 60%),
                radial-gradient(ellipse at 20% 80%, rgba(234,179,8,0.05) 0%, transparent 50%);
    z-index: 1;
    pointer-events: none;
}

/* ============================================================
   3D SYSTEM — Tilt Cards
   ============================================================ */
.tilt-card {
    transform-style: preserve-3d;
    transition: var(--tilt-transition);
    will-change: transform;
    cursor: default;
}

.tilt-card:hover {
    box-shadow: 0 30px 60px -15px rgba(185,28,28,0.18), 0 8px 24px -8px rgba(0,0,0,0.1) !important;
}

/* Inner content lifted in Z */
.tilt-card .tilt-inner {
    transform: translateZ(20px);
    transform-style: preserve-3d;
}

/* ============================================================
   3D SYSTEM — Floating Shapes (CSS 3D decorations)
   ============================================================ */
.shape-float {
    position: absolute;
    pointer-events: none;
    animation: shapeFloat 7s ease-in-out infinite;
}

.shape-float:nth-child(2) { animation-delay: -2.5s; animation-duration: 9s; }
.shape-float:nth-child(3) { animation-delay: -4s;   animation-duration: 6s; }

@keyframes shapeFloat {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    33%       { transform: translateY(-18px) rotate(3deg); }
    66%       { transform: translateY(-8px)  rotate(-2deg); }
}

/* ── Hexagon shape ── */
.shape-hex {
    width: 60px; height: 60px;
    background: linear-gradient(135deg, rgba(185,28,28,0.12), rgba(234,179,8,0.08));
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
}

/* ── Circle shape ── */
.shape-circle {
    border-radius: 50%;
    border: 2px solid rgba(185,28,28,0.15);
    background: transparent;
}

/* ── Ring shape ── */
.shape-ring {
    border-radius: 50%;
    border: 3px solid rgba(234,179,8,0.2);
    background: transparent;
    box-shadow: inset 0 0 20px rgba(234,179,8,0.05);
}

/* ── Cross/Plus shape ── */
.shape-plus::before,
.shape-plus::after {
    content: '';
    position: absolute;
    background: rgba(185,28,28,0.15);
    border-radius: 2px;
}
.shape-plus::before { width: 2px; height: 100%; left: 50%; transform: translateX(-50%); }
.shape-plus::after  { width: 100%; height: 2px; top: 50%;  transform: translateY(-50%); }
.shape-plus { position: relative; }

/* ============================================================
   3D SYSTEM — GSAP Text Reveal
   ============================================================ */
.reveal-wrap {
    overflow: hidden;
    display: inline-block;
    vertical-align: bottom;
}

.reveal-word {
    display: inline-block;
    will-change: transform, opacity;
}

/* ============================================================
   3D SYSTEM — Scroll Reveal base states
   ============================================================ */
.gsap-reveal {
    opacity: 0;
    transform: translateY(40px);
}

.gsap-reveal-left {
    opacity: 0;
    transform: translateX(-40px);
}

.gsap-reveal-right {
    opacity: 0;
    transform: translateX(40px);
}

.gsap-reveal-scale {
    opacity: 0;
    transform: scale(0.88);
}

/* ============================================================
   3D SYSTEM — Glow effects
   ============================================================ */
.glow-red {
    transition: box-shadow var(--transition-normal);
}
.glow-red:hover {
    box-shadow: 0 0 0 3px rgba(185,28,28,0.15), 0 20px 40px -10px rgba(185,28,28,0.2) !important;
}

.glow-gold {
    transition: box-shadow var(--transition-normal);
}
.glow-gold:hover {
    box-shadow: 0 0 0 3px rgba(234,179,8,0.2), 0 20px 40px -10px rgba(234,179,8,0.15) !important;
}

/* ============================================================
   3D SYSTEM — Animated gradient CTA backgrounds
   ============================================================ */
.gradient-animate {
    background-size: 200% 200%;
    animation: gradient-drift 6s ease infinite;
}

@keyframes gradient-drift {
    0%   { background-position: 0% 50%; }
    50%  { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* ── CTA with animated blobs ── */
.cta-section {
    position: relative;
    overflow: hidden;
}

.cta-blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    pointer-events: none;
    animation: blobDrift 10s ease-in-out infinite alternate;
}

@keyframes blobDrift {
    from { transform: translate(0, 0) scale(1); }
    to   { transform: translate(40px, -30px) scale(1.1); }
}

/* ============================================================
   3D SYSTEM — Counter number animation
   ============================================================ */
.counter-num {
    display: inline-block;
    font-variant-numeric: tabular-nums;
}

/* ============================================================
   3D SYSTEM — Service card icon bounce on hover
   ============================================================ */
.icon-bounce {
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: inline-flex;
}
.tilt-card:hover .icon-bounce {
    transform: translateY(-6px) scale(1.12);
}

/* ============================================================
   3D SYSTEM — Timeline SVG draw animation
   ============================================================ */
.timeline-line {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
}
.timeline-line.drawn {
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 1.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Step number pop ── */
.step-pop {
    transform: scale(0) rotate(-10deg);
    opacity: 0;
    transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
}
.step-pop.popped {
    transform: scale(1) rotate(0deg);
    opacity: 1;
}

/* ============================================================
   3D SYSTEM — Card grid stagger base
   ============================================================ */
.stagger-item {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}
.stagger-item.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ============================================================
   3D SYSTEM — Parallax layers
   ============================================================ */
.parallax-slow  { will-change: transform; }
.parallax-med   { will-change: transform; }
.parallax-fast  { will-change: transform; }

/* ============================================================
   3D SYSTEM — FAQ GSAP
   ============================================================ */
.faq-body {
    overflow: hidden;
    height: 0;
}

.faq-toggle[aria-expanded="true"] .faq-chevron {
    transform: rotate(180deg);
}
.faq-chevron {
    transition: transform 0.3s ease;
    flex-shrink: 0;
}

/* ============================================================
   3D SYSTEM — Chip / badge
   ============================================================ */
.badge-3d {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 14px;
    background: rgba(185,28,28,0.07);
    border: 1px solid rgba(185,28,28,0.18);
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #B91C1C;
}

/* ============================================================
   Reduced-motion override for 3D system
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
    .shape-float,
    .cta-blob,
    .gradient-animate {
        animation: none !important;
    }
    .tilt-card {
        transition: box-shadow 0.01ms !important;
    }
    .gsap-reveal,
    .gsap-reveal-left,
    .gsap-reveal-right,
    .gsap-reveal-scale,
    .stagger-item {
        opacity: 1 !important;
        transform: none !important;
    }
}
/* ============================================================
   Sede hero — Ken Burns background image for inner pages
   ============================================================ */
@keyframes kenburns-sede {
    0%   { transform: scale(1)    translate(0,    0);    }
    50%  { transform: scale(1.07) translate(-0.8%, -0.5%); }
    100% { transform: scale(1)    translate(0,    0);    }
}
.sede-kenburns {
    animation: kenburns-sede 20s ease-in-out infinite;
    will-change: transform;
}
/* Text colour overrides inside the photo hero */
.sede-hero .hero-sub-anim {
    color: rgba(255, 255, 255, 0.9) !important;
}
.sede-hero .badge-3d {
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.25);
    color: #fff;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}
@media (prefers-reduced-motion: reduce) {
    .sede-kenburns { animation: none !important; }
}
