/**
 * Components Styles
 * Reusable UI components for the portfolio
 */

/* ============================================
   Navigation
   ============================================ */
.nav {
    position: sticky;
    top: 0;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    z-index: var(--z-sticky);
    padding: var(--space-2) 0;
}

.nav-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    font-size: var(--text-xl);
    font-weight: 700;
    color: var(--text);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.logo:hover {
    color: var(--accent);
}

.logo-text {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: var(--space-1);
    color: var(--text);
    width: 44px;
    height: 44px;
    position: relative;
}

.hamburger,
.hamburger::before,
.hamburger::after {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
    transition: all var(--transition-base);
}

.hamburger {
    position: relative;
}

.hamburger::before,
.hamburger::after {
    content: '';
    position: absolute;
    left: 0;
}

.hamburger::before {
    top: -7px;
}

.hamburger::after {
    top: 7px;
}

.nav-toggle[aria-expanded="true"] .hamburger {
    background: transparent;
}

.nav-toggle[aria-expanded="true"] .hamburger::before {
    transform: rotate(45deg);
    top: 0;
}

.nav-toggle[aria-expanded="true"] .hamburger::after {
    transform: rotate(-45deg);
    top: 0;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: var(--space-1);
    align-items: center;
    margin: 0;
    padding: 0;
}

.nav-link {
    display: block;
    padding: var(--space-1) var(--space-2);
    color: var(--muted);
    font-weight: 500;
    font-size: var(--text-sm);
    transition: all var(--transition-fast);
    border-radius: var(--radius-sm);
    min-height: 44px;
    display: flex;
    align-items: center;
}

.nav-link:hover {
    color: var(--text);
    background: var(--elev);
}

.nav-link.active {
    color: var(--accent);
}

.nav-link-cta {
    background: var(--accent);
    color: var(--bg);
    font-weight: 600;
}

.nav-link-cta:hover {
    background: var(--accent-2);
    color: var(--bg);
    transform: translateY(-1px);
}

/* Mobile Navigation */
@media (max-width: 768px) {
    .nav-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .nav-menu {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--elev);
        flex-direction: column;
        gap: 0;
        padding: var(--space-2);
        border-bottom: 1px solid var(--border);
        box-shadow: var(--shadow-lg);
        display: none;
    }
    
    .nav-menu.active {
        display: flex;
    }
    
    .nav-link {
        width: 100%;
        padding: var(--space-2);
    }
}

/* ============================================
   Buttons
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-1);
    padding: 12px 24px;
    font-size: var(--text-base);
    font-weight: 600;
    font-family: inherit;
    line-height: 1.5;
    text-decoration: none;
    border: 2px solid transparent;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    min-height: 44px;
    white-space: nowrap;
}

.btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.btn-primary {
    background: var(--accent);
    color: var(--bg);
    border-color: var(--accent);
}

.btn-primary:hover {
    background: var(--accent-2);
    border-color: var(--accent-2);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: transparent;
    color: var(--text);
    border-color: var(--border);
}

.btn-secondary:hover {
    background: var(--elev);
    border-color: var(--accent);
    color: var(--accent);
    transform: translateY(-2px);
}

.btn-lg {
    padding: 16px 32px;
    font-size: var(--text-lg);
}

.btn-sm {
    padding: 8px 16px;
    font-size: var(--text-sm);
    min-height: 36px;
}

/* ============================================
   Badges & Tags
   ============================================ */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    font-size: var(--text-sm);
    font-weight: 600;
    border-radius: 999px;
    background: var(--elev);
    color: var(--text);
    border: 1px solid var(--border);
}

.badge-sm {
    padding: 4px 10px;
    font-size: var(--text-xs);
}

.badge-accent {
    background: rgba(48, 196, 141, 0.1);
    color: var(--accent);
    border-color: var(--accent);
}

.tag {
    display: inline-block;
    padding: 4px 10px;
    font-size: var(--text-xs);
    font-weight: 500;
    border-radius: var(--radius-sm);
    background: var(--elev);
    color: var(--muted);
    border: 1px solid var(--border);
    transition: all var(--transition-fast);
}

.tag:hover {
    background: var(--accent);
    color: var(--bg);
    border-color: var(--accent);
}

/* ============================================
   Cards
   ============================================ */
.card {
    background: var(--elev);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-3);
    transition: all var(--transition-base);
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
    border-color: var(--accent);
}

/* ============================================
   Hero Section
   ============================================ */
.hero {
    min-height: 80vh;
    display: flex;
    align-items: center;
    padding: clamp(32px, 8vw, 96px) 0;
    position: relative;
}

.hero-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-6);
    align-items: center;
}

.hero-content {
    max-width: 600px;
}

.hero-badge {
    margin-bottom: var(--space-2);
}

.hero-title {
    font-size: var(--text-4xl);
    line-height: 1.15;
    margin-bottom: var(--space-3);
    font-weight: 800;
}

.hero-subtitle {
    font-size: var(--text-lg);
    color: var(--muted);
    margin-bottom: var(--space-4);
    line-height: 1.7;
}

.hero-cta {
    display: flex;
    gap: var(--space-2);
    flex-wrap: wrap;
}

.hero-visual {
    display: flex;
    justify-content: center;
    align-items: center;
}

.hero-image-wrapper {
    position: relative;
    max-width: 400px;
    width: 100%;
}

.hero-image {
    width: 100%;
    height: auto;
    border-radius: var(--radius-xl);
    border: 2px solid var(--border);
    box-shadow: var(--shadow-xl);
}

.hero-image-decoration {
    position: absolute;
    top: -10px;
    right: -10px;
    bottom: 10px;
    left: 10px;
    border: 2px solid var(--accent);
    border-radius: var(--radius-xl);
    z-index: -1;
}

@media (min-width: 1024px) {
    .hero-container {
        grid-template-columns: 7fr 5fr;
    }
    
    .hero-title {
        font-size: var(--text-5xl);
    }
}

@media (max-width: 479px) {
    .hero-cta {
        flex-direction: column;
    }
    
    .hero-cta .btn {
        width: 100%;
    }
}

/* ============================================
   Proof Bar
   ============================================ */
.proof-bar {
    padding: var(--space-6) 0;
    background: var(--elev);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.proof-label {
    text-align: center;
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--muted);
    margin-bottom: var(--space-3);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.proof-logos {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: var(--space-2);
}

.proof-item {
    padding: var(--space-1) var(--space-2);
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--muted);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.proof-item:hover {
    color: var(--accent);
    border-color: var(--accent);
    transform: translateY(-2px);
}

/* ============================================
   Metrics Section
   ============================================ */
.metrics {
    padding: var(--space-8) 0;
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--space-3);
}

.metric-card {
    text-align: center;
    padding: var(--space-4);
    background: var(--elev);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    transition: all var(--transition-base);
}

.metric-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--accent);
}

.metric-value {
    font-size: var(--text-4xl);
    font-weight: 800;
    color: var(--accent);
    margin-bottom: var(--space-1);
}

.metric-label {
    font-size: var(--text-sm);
    color: var(--muted);
    font-weight: 500;
}

/* ============================================
   Section Headers
   ============================================ */
section {
    padding: clamp(48px, 8vw, 96px) 0;
}

.section-header {
    text-align: center;
    max-width: 700px;
    margin: 0 auto var(--space-6);
}

.section-title {
    font-size: var(--text-3xl);
    margin-bottom: var(--space-2);
    font-weight: 800;
}

.section-subtitle {
    font-size: var(--text-lg);
    color: var(--muted);
}

.section-cta {
    text-align: center;
    margin-top: var(--space-6);
}

/* ============================================
   Project Cards
   ============================================ */
.projects-featured {
    background: var(--bg);
}

.projects-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-4);
}

@media (min-width: 480px) {
    .projects-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .projects-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 1440px) {
    .projects-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.project-card {
    background: var(--elev);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all var(--transition-base);
    display: flex;
    flex-direction: column;
}

.project-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-xl);
    border-color: var(--accent);
}

.project-link {
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.project-header {
    padding: var(--space-3) var(--space-3) var(--space-2);
    background: var(--bg);
    border-bottom: 1px solid var(--border);
}

.project-card-title {
    font-size: var(--text-lg);
    font-weight: 600;
    color: var(--text);
    margin: 0;
    line-height: 1.4;
}

.project-image {
    width: 100%;
    height: 200px;
    overflow: hidden;
    background: var(--bg);
    position: relative;
}

.project-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-slow);
}

.project-card:hover .project-image img {
    transform: scale(1.05);
}

.project-content {
    padding: var(--space-3);
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.project-title {
    font-size: var(--text-xl);
    margin-bottom: var(--space-2);
    color: var(--text);
}

.project-summary {
    color: var(--muted);
    margin-bottom: var(--space-2);
    line-height: 1.6;
    flex-grow: 1;
}

.project-tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1);
    margin-bottom: var(--space-2);
}

.project-cta {
    color: var(--accent);
    font-weight: 600;
    font-size: var(--text-sm);
    transition: all var(--transition-fast);
}

.project-card:hover .project-cta {
    color: var(--accent-2);
    transform: translateX(4px);
    display: inline-block;
}

/* ============================================
   Services Section
   ============================================ */
.services {
    background: var(--elev);
}

.services-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-4);
}

@media (min-width: 768px) {
    .services-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .services-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.service-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    transition: all var(--transition-base);
}

.service-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--accent);
}

.service-icon {
    width: 48px;
    height: 48px;
    margin-bottom: var(--space-3);
    color: var(--accent);
}

.service-title {
    font-size: var(--text-xl);
    margin-bottom: var(--space-2);
}

.service-description {
    color: var(--muted);
    margin-bottom: var(--space-3);
    line-height: 1.7;
}

.service-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.service-list li {
    padding: var(--space-1) 0;
    color: var(--muted);
    position: relative;
    padding-left: var(--space-3);
}

.service-list li::before {
    content: '→';
    position: absolute;
    left: 0;
    color: var(--accent);
    font-weight: 600;
}

/* ============================================
   Testimonials
   ============================================ */
.testimonials {
    background: var(--bg);
}

/* Infinite Scrolling Marquee */
.testimonial-scroller {
    /* Hides the overflowing content */
    overflow: hidden;
    
    /* Creates a faded edge effect */
    -webkit-mask: linear-gradient(
        90deg,
        transparent,
        white 20%,
        white 80%,
        transparent
    );
    mask: linear-gradient(90deg, transparent, white 20%, white 80%, transparent);
}

.scroller-inner {
    display: flex !important;
    /* Adds a gap between cards */
    gap: var(--space-4);
    /* Ensures content doesn't wrap to the next line */
    flex-wrap: nowrap !important;
    /* Make the container wide enough to hold all cards */
    width: max-content !important;
    align-items: flex-start;
}

/* Keyframe animation for scrolling */
@keyframes scroll {
    /* Start at the beginning */
    from {
        transform: translateX(0);
    }
    /* Animate to the end (which is -50% of the total width,
       since we duplicated the content) */
    to {
        transform: translateX(-50%);
    }
}

/* Apply the animation only if 'data-animated' is true */
.testimonial-scroller[data-animated="true"] .scroller-inner {
    /* - Adjust the '40s' to change the speed.
      - 'linear' ensures a constant speed.
      - 'infinite' makes it loop forever.
    */
    animation: scroll 40s linear infinite;
}

/* This is the magic part that pauses the animation on hover */
.testimonial-scroller[data-animated="true"]:hover .scroller-inner {
    animation-play-state: paused;
}

.testimonials-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-4);
}

@media (min-width: 768px) {
    .testimonials-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .testimonials-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.testimonial-card {
    background: var(--elev);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    transition: all var(--transition-base);
    /* Set a fixed width for the cards in the scroller */
    min-width: 350px;
    max-width: 400px;
    flex-shrink: 0;
    display: block;
    /* Override blockquote default styles */
    margin: 0;
    border-left: none;
    font-style: normal;
}

.testimonial-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--accent-2);
}

.testimonial-icon {
    color: var(--accent);
    margin-bottom: var(--space-2);
    display: flex;
    align-items: center;
}

.testimonial-icon svg {
    width: 24px;
    height: 24px;
}

.testimonial-text {
    font-size: var(--text-base);
    line-height: 1.7;
    color: #000000 !important;
    margin-bottom: var(--space-3);
    font-style: italic;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    white-space: normal;
}

.testimonial-text::before {
    content: '"';
    font-size: var(--text-3xl);
    color: var(--accent);
    line-height: 0;
    display: block;
    margin-bottom: var(--space-2);
}

.testimonial-tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1);
    margin-bottom: var(--space-3);
}

.testimonial-footer {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.testimonial-author {
    font-weight: 600;
    font-style: normal;
    color: var(--text);
}

.testimonial-role {
    font-size: var(--text-sm);
    color: var(--muted);
}

/* ============================================
   CTA Section
   ============================================ */
.cta-section {
    background: linear-gradient(135deg, var(--elev) 0%, var(--bg) 100%);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.cta-content {
    text-align: center;
    max-width: 700px;
    margin: 0 auto;
}

.cta-title {
    font-size: var(--text-3xl);
    margin-bottom: var(--space-2);
    font-weight: 800;
}

.cta-text {
    font-size: var(--text-lg);
    color: var(--muted);
    margin-bottom: var(--space-4);
}

.cta-buttons {
    display: flex;
    gap: var(--space-2);
    justify-content: center;
    flex-wrap: wrap;
}

@media (max-width: 479px) {
    .cta-buttons {
        flex-direction: column;
    }
    
    .cta-buttons .btn {
        width: 100%;
    }
}

/* ============================================
   Footer
   ============================================ */
.footer {
    background: var(--elev);
    border-top: 1px solid var(--border);
    padding: var(--space-8) 0 var(--space-4);
}

.footer-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-6);
    margin-bottom: var(--space-6);
}

@media (min-width: 768px) {
    .footer-grid {
        grid-template-columns: 2fr 1fr 1fr 1fr;
    }
}

.footer-heading {
    font-size: var(--text-lg);
    margin-bottom: var(--space-2);
    color: var(--text);
}

.footer-text {
    color: var(--muted);
    line-height: 1.7;
    margin-bottom: var(--space-3);
    font-size: var(--text-sm);
}

.footer-social {
    display: flex;
    gap: var(--space-2);
}

.social-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--muted);
    transition: all var(--transition-fast);
}

.social-link:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--bg);
    transform: translateY(-2px);
}

.footer-links {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-links li {
    margin-bottom: var(--space-1);
}

.footer-links a {
    color: var(--muted);
    font-size: var(--text-sm);
    transition: color var(--transition-fast);
}

.footer-links a:hover {
    color: var(--accent);
}

.footer-bottom {
    border-top: 1px solid var(--border);
    padding-top: var(--space-4);
    text-align: center;
    color: var(--muted);
    font-size: var(--text-sm);
}

.footer-note {
    margin-top: var(--space-1);
    font-size: var(--text-xs);
}

/* ============================================
   Form Elements
   ============================================ */
.form-group {
    margin-bottom: var(--space-3);
}

.form-label {
    display: block;
    margin-bottom: var(--space-1);
    font-weight: 600;
    color: #000000 !important;
    font-size: var(--text-sm);
}

.form-input,
.form-textarea,
.form-select {
    width: 100%;
    padding: 12px 16px;
    font-size: var(--text-base);
    font-family: inherit;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    min-height: 44px;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(48, 196, 141, 0.1);
}

.form-textarea {
    min-height: 120px;
    resize: vertical;
}

.form-helper {
    display: block;
    margin-top: var(--space-1);
    font-size: var(--text-sm);
    color: #666666;
}

.form-error {
    color: var(--danger);
}

/* ============================================
   Filter Pills (Projects Page)
   ============================================ */
.filter-container {
    margin-bottom: var(--space-6);
}

.filter-pills {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    justify-content: center;
}

.filter-pill {
    padding: 10px 20px;
    font-size: var(--text-sm);
    font-weight: 600;
    border: 2px solid var(--border);
    border-radius: 999px;
    background: var(--elev);
    color: var(--text);
    cursor: pointer;
    transition: all var(--transition-fast);
    min-height: 44px;
}

.filter-pill:hover {
    border-color: var(--accent);
    color: var(--accent);
    transform: translateY(-2px);
}

.filter-pill.active {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--bg);
}

/* ============================================
   Timeline (About Page)
   ============================================ */
.timeline {
    position: relative;
    padding-left: var(--space-4);
}

.timeline::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border);
}

.timeline-item {
    position: relative;
    padding-bottom: var(--space-4);
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -22px;
    top: 4px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--accent);
    border: 2px solid var(--bg);
}

.timeline-date {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--accent);
    margin-bottom: var(--space-1);
}

.timeline-title {
    font-size: var(--text-lg);
    font-weight: 700;
    margin-bottom: var(--space-1);
}

.timeline-description {
    color: var(--muted);
    line-height: 1.7;
}

/* ============================================
   Loading States
   ============================================ */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid var(--border);
    border-radius: 50%;
    border-top-color: var(--accent);
    animation: spin 0.8s linear infinite;
}

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

/* ============================================
   Utility Classes
   ============================================ */
.highlight {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
