/**
 * Sparkles Author Profiles CSS
 * Complete styling for author profile components
 * Extends: sparkles-utilities.css, sparkles-animations.css, sparkles-tokens.css
 * All 3 optimization layers applied: keyframes consolidated, patterns extracted, component organization
 * 
 * Features:
 * - Multiple display modes (card, inline, sidebar, modal)
 * - Responsive design with mobile-first approach
 * - Accessibility support with focus states
 * - Loading and error states
 * - Social media integration styling
 * - Expandable biography
 * - Follow button with states
 * 
 * @version 1.0.0
 * @author Sparkles Design Library
 */

/* ========================================================================
   Base Author Profile Styles
   ======================================================================== */

.sparkles-author-profile {
    position: relative;
    color: var(--gray-700);
    line-height: 1.625;
}

/* Container query anchors for author profile layouts */
:where(.sparkles-author-profile,
    .sparkles-author-profile--card,
    .sparkles-author-profile--inline,
    .sparkles-author-profile--sidebar,
    .sparkles-author-profile--modal) {
    container-type: inline-size;
}

.sparkles-author-profile * {
    box-sizing: border-box;
}

/* ========================================================================
   Display Mode Variants
   ======================================================================== */

/* Card Mode */
/* Base card styling moved to sparkles-utilities.css (.sparkles-card-bordered-lg) */
.sparkles-author-profile--card {
    padding: 1.5rem;
    transition: all .3s ease-out;
}

.sparkles-author-profile--hero {
    background: linear-gradient(to right,
            color-mix(in srgb, var(--color-primary) 10%, transparent),
            color-mix(in srgb, var(--color-primary) 5%, transparent));
}

.sparkles-author-profile--card:hover {
    --tw-shadow: 0 4px 6px -1px #0000001a, 0 2px 4px -2px #0000001a;
    --tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);
}

/* Inline Mode */
.sparkles-author-profile--inline {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding-top: .75rem;
    padding-bottom: .75rem;
    border-bottom-width: 1px;
    border-color: var(--gray-200);
}

.sparkles-author-profile--inline .sparkles-author-avatar {
    flex-shrink: 0;
}

.sparkles-author-profile--inline .sparkles-author-info {
    flex: 1 1 0%;
    margin-top: 0;
}

/* Sidebar Mode */
.sparkles-author-profile--sidebar {
    border-color: var(--color-primary);
    background-color: var(--gray-50);
    padding: 1.25rem;
    border-radius: var(--radius-card);
    border-left-width: 4px;
}

/* Modal Mode */
.sparkles-author-profile--modal,
.sparkles-author-contact-modal-content {
    --tw-bg-opacity: 1;
    background-color: rgba(255, 255, 255, var(--tw-bg-opacity, 1));
    border-radius: var(--radius-card);
    padding: 2rem;
    width: 100%;
    position: relative;
    --tw-shadow: 0 25px 50px -12px #00000040;
    --tw-shadow-colored: 0 25px 50px -12px var(--tw-shadow-color);
}

.sparkles-author-profile--modal {
    max-width: 32rem;
}

/* ========================================================================
   Avatar Styles
   ======================================================================== */

.sparkles-author-avatar {
    position: relative;
    display: inline-block;
}

.sparkles-author-avatar img {
    width: 4rem;
    height: 4rem;
    border-radius: var(--radius-full);
    object-fit: cover;
    border-width: 4px;
    border-color: var(--gray-200);
    transition-property: color, background-color, border-color, fill, stroke, -webkit-text-decoration-color;
    transition-property: color, background-color, border-color, text-decoration-color, fill, stroke;
    transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, -webkit-text-decoration-color;
    transition-timing-function: cubic-bezier(.4, 0, .2, 1);
    transition-duration: .15s;
    transition-duration: .3s;
}

.sparkles-author-profile--card .sparkles-author-avatar img,
.sparkles-author-profile--modal .sparkles-author-avatar img {
    width: 5rem;
    height: 5rem;
}

.sparkles-author-profile--sidebar .sparkles-author-avatar img {
    width: 3rem;
    height: 3rem;
}

.sparkles-author-avatar:hover img {
    border-color: var(--color-primary);
}

/* Avatar fallback */
.sparkles-author-avatar--fallback {
    background-color: var(--color-primary);
    width: 4rem;
    height: 4rem;
    border-radius: var(--radius-full);
    --tw-text-opacity: 1;
    color: rgba(255, 255, 255, var(--tw-text-opacity, 1));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1.25rem;
    line-height: 1.75rem;
    border-width: 4px;
    border-color: var(--gray-200);
}

/* ========================================================================
   Author Information
   ======================================================================== */

.sparkles-author-info {
    margin-top: 1rem;
}


.sparkles-author-name {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: .25rem;
    line-height: 1.625;
}

.sparkles-author-profile--inline .sparkles-author-name {
    font-size: 1rem;
    line-height: 1.5rem;
}

.sparkles-author-position,
.sparkles-author-location {
    color: var(--gray-500);
    margin-bottom: .5rem;
}

.sparkles-author-company {
    color: var(--color-primary);
    font-weight: 500;
}

.sparkles-author-join-date {
    font-style: italic;
}

/* ========================================================================
   Biography Styles
   ======================================================================== */

.sparkles-author-bio {
    margin-top: 1rem;
    margin-bottom: 1rem;
    line-height: 1.625;
}

.sparkles-author-profile--inline .sparkles-author-bio {
    margin-top: .5rem;
}

.sparkles-author-bio-text {
    color: var(--gray-700);
    margin-bottom: .5rem;
}

.sparkles-author-bio-toggle {
    color: var(--color-primary);
    background-color: initial;
    border-width: 0;
    cursor: pointer;
    font-size: .875rem;
    line-height: 1.25rem;
    font-weight: 500;
    padding: 0;
    -webkit-text-decoration-line: none;
    text-decoration-line: none;
    transition-property: color, background-color, border-color, fill, stroke, -webkit-text-decoration-color;
    transition-property: color, background-color, border-color, text-decoration-color, fill, stroke;
    transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, -webkit-text-decoration-color;
    transition-timing-function: cubic-bezier(.4, 0, .2, 1);
    transition-duration: .15s;
    transition-duration: .3s;
}

.sparkles-author-bio-toggle:hover {
    color: var(--color-primary);
    -webkit-text-decoration-line: underline;
    text-decoration-line: underline;
}

.sparkles-author-bio-toggle:focus,
.sparkles-author-profile *:focus-visible {
    border-radius: var(--radius-sm);
}

/* ========================================================================
   Statistics Styles
   ======================================================================== */

.sparkles-author-stats {
    display: flex;
    gap: 1.5rem;
    margin-top: 1rem;
    margin-bottom: 1rem;
    padding-top: 1rem;
    padding-bottom: 1rem;
    border-top-width: 1px;
    border-color: var(--gray-200);
}

.sparkles-author-profile--inline .sparkles-author-stats {
    gap: 1rem;
    margin-top: .5rem;
    padding-top: .5rem;
}

.sparkles-author-stat {
    text-align: center;
    flex: 1 1 0%;
}

.sparkles-author-stat-value {
    display: block;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--gray-800);
    line-height: 1.25;
}

.sparkles-author-profile--inline .sparkles-author-stat-value {
    font-size: 1rem;
    line-height: 1.5rem;
}

.sparkles-author-stat-label {
    display: block;
    font-size: .75rem;
    line-height: 1rem;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: .05em;
}

/* ========================================================================
   Social Links Styles
   ======================================================================== */

.sparkles-author-social {
    gap: .75rem;
}

.sparkles-author-profile--inline .sparkles-author-social {
    margin-top: .5rem;
    gap: .5rem;
}

.sparkles-author-social-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: var(--radius-full);
    background-color: var(--gray-100);
    color: var(--gray-500);
    -webkit-text-decoration-line: none;
    text-decoration-line: none;
    transition-property: all;
    transition-timing-function: cubic-bezier(.4, 0, .2, 1);
    transition-duration: .3s;
    border-width: 1px;
    border-color: #0000;
}

.sparkles-author-profile--inline .sparkles-author-social-link {
    width: 2rem;
    height: 2rem;
}

.sparkles-author-social-link:hover {
    background-color: var(--color-primary);
}

/* Platform-specific colors */
.sparkles-author-social-link--twitter:hover {
    background-color: #1da1f2;
}

.sparkles-author-social-link--linkedin:hover {
    background-color: #0077b5;
}

.sparkles-author-social-link--facebook:hover {
    background-color: #1877f2;
}

.sparkles-author-social-link--instagram:hover {
    background-color: #e4405f;
}

.sparkles-author-social-link--github:hover {
    background-color: #333;
}

.sparkles-author-social-link--youtube:hover {
    background-color: #ff0000;
}

/* ========================================================================
   Action Buttons
   ======================================================================== */

.sparkles-author-actions {
    display: flex;
    gap: .75rem;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

.sparkles-author-profile--inline .sparkles-author-actions {
    margin-top: .75rem;
}

.sparkles-author-follow-btn,
.sparkles-author-contact-btn {
    min-width: 120px;
    flex: 1 1 0%;
    padding-top: .75rem;
    padding-bottom: .75rem;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
    border-radius: var(--radius-btn);
    font-weight: 500;
    font-size: .875rem;
    line-height: 1.25rem;
    transition-property: all;
    transition-timing-function: cubic-bezier(.4, 0, .2, 1);
    transition-duration: .3s;
    cursor: pointer;
    border-width: 1px;
    text-align: center;
    -webkit-text-decoration-line: none;
    text-decoration-line: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
}

.sparkles-author-follow-btn:hover {
    background-color: var(--color-primary);
    border-color: var(--color-primary);
    transform: translateY(-1px);
}

.sparkles-author-follow-btn:disabled {
    opacity: .6;
    cursor: not-allowed;
}

/* Contact button styles */
.sparkles-author-contact-btn {
    color: var(--color-primary);
    border-color: var(--color-primary);
    background-color: initial;
}

.sparkles-author-contact-btn:hover {
    background-color: var(--color-primary);
    --tw-text-opacity: 1;
    color: rgba(255, 255, 255, var(--tw-text-opacity, 1));
    transform: translateY(-1px);
}

/* ========================================================================
   Loading States
   ======================================================================== */

.sparkles-author-profile--loading {
    opacity: .7;
    pointer-events: none;
}

.sparkles-author-loading-spinner {
    animation: sparkles-spin 1s linear infinite;
    display: inline-block;
    width: 1.25rem;
    height: 1.25rem;
    border-width: 2px;
    border-color: #0000;
    border-radius: var(--radius-full);
}

/* sparkles-spin keyframe moved to sparkles-utilities.css */

/* ========================================================================
   Error States
   ======================================================================== */

.sparkles-author-profile--error {
    --tw-border-opacity: 1;
    border-color: rgba(239, 68, 68, var(--tw-border-opacity, 1));
}

.sparkles-author-error-message {
    --tw-text-opacity: 1;
    color: rgba(239, 68, 68, var(--tw-text-opacity, 1));
    font-size: .875rem;
    line-height: 1.25rem;
    margin-top: .5rem;
    padding: .75rem;
    --tw-bg-opacity: 1;
    background-color: rgba(254, 242, 242, var(--tw-bg-opacity, 1));
    border-radius: var(--radius-btn);
    border-width: 1px;
    --tw-border-opacity: 1;
    border-color: rgba(254, 202, 202, var(--tw-border-opacity, 1));
}

/* ========================================================================
   Contact Modal Styles
   ======================================================================== */

.sparkles-author-contact-modal {
    z-index: var(--z-modal);
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    --tw-bg-opacity: 1;
    background-color: rgba(0, 0, 0, var(--tw-bg-opacity, 1));
    --tw-bg-opacity: 0.5;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.sparkles-author-contact-modal-content {
    max-width: 24rem;
}

.sparkles-author-contact-modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background-color: initial;
    border-width: 0;
    font-size: 1.5rem;
    line-height: 2rem;
    cursor: pointer;
    color: var(--gray-500);
    transition-property: color, background-color, border-color, fill, stroke, -webkit-text-decoration-color;
    transition-property: color, background-color, border-color, text-decoration-color, fill, stroke;
    transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, -webkit-text-decoration-color;
    transition-timing-function: cubic-bezier(.4, 0, .2, 1);
    transition-duration: .15s;
    transition-duration: .3s;
}

.sparkles-author-contact-modal-close:hover {
    color: var(--gray-700);
}

/* ========================================================================
   Responsive Design
   ======================================================================== */

@container (max-width: 768px) {
    .sparkles-author-profile--card {
        padding: 1rem;
    }

    .sparkles-author-profile--modal {
        padding: 1.5rem;
        margin: 1rem;
    }

    .sparkles-author-stats {
        gap: 1rem;
    }

    .sparkles-author-actions {
        flex-direction: column;
    }

    .sparkles-author-follow-btn,
    .sparkles-author-contact-btn {
        flex: none;
        min-width: 0;
    }

    .sparkles-author-social {
        justify-content: center;
    }
}

@container (max-width: 475px) {
    .sparkles-author-profile--inline {
        flex-direction: column;
        align-items: flex-start;
        gap: .75rem;
    }

    .sparkles-author-profile--inline .sparkles-author-info {
        width: 100%;
    }

    .sparkles-author-stats {
        justify-content: space-around;
    }
}

/* ========================================================================
   Accessibility Enhancements
   ======================================================================== */

@media (prefers-reduced-motion: reduce) {

    .sparkles-author-profile--card,
    .sparkles-author-social-link,
    .sparkles-author-follow-btn,
    .sparkles-author-contact-btn {
        transition-property: none;
    }

    .sparkles-author-profile--card:hover {
        box-shadow: none;
    }

    .sparkles-author-social-link:hover {
        transform: none;
    }

    .sparkles-author-loading-spinner {
        animation: none;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .sparkles-author-profile--card {
        border-width: 2px;
    }

    .sparkles-author-follow-btn,
    .sparkles-author-contact-btn {
        border-width: 2px;
    }
}
