/**
 * Personal Link in Bio - Public Styles
 *
 * A modern, beautiful, theme-independent stylesheet.
 * Uses CSS variables for dynamic theming.
 *
 * @package PersonalLinkInBio
 */

/* ==========================================================================
   CSS Reset (Scoped)
   ========================================================================== */

/* Prevent white flash on page load - use dark background by default */
html {
    background-color: var(--plib-background, #0f0f0f);
}

.plib-body,
.plib-body *,
.plib-body *::before,
.plib-body *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

.plib-body {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    font-size: var(--plib-font-size, 16px);
    line-height: 1.6;
    color: var(--plib-text-primary, #ffffff);
    background-color: var(--plib-background, #0f0f0f);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
}

/* When background effects are active, canvas provides the background */
.plib-body.plib-has-bg-effect {
    background-color: transparent !important;
    background: transparent !important;
}

.plib-body.plib-has-bg-effect .plib-wrapper {
    background: transparent !important;
    background-image: none !important;
}

html:has(.plib-has-bg-effect) {
    background-color: transparent !important;
}

.plib-body img {
    max-width: 100%;
    height: auto;
    display: block;
}

.plib-body a {
    color: inherit;
    text-decoration: none;
}

.plib-body h1,
.plib-body h2,
.plib-body h3,
.plib-body p {
    margin: 0;
}

/* ==========================================================================
   Layout
   ========================================================================== */

.plib-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem 1rem 3rem;
    background: var(--plib-background, #0f0f0f);
    /* Subtle gradient overlay for depth */
    background-image: 
        radial-gradient(ellipse at top, rgba(255, 255, 255, 0.02) 0%, transparent 50%),
        radial-gradient(ellipse at bottom, rgba(0, 0, 0, 0.3) 0%, transparent 50%);
}

.plib-container {
    width: 100%;
    max-width: 480px;
    display: flex;
    flex-direction: column;
    gap: 1.75rem;
}

/* ==========================================================================
   Header Section (Profile + Bio + Social)
   ========================================================================== */

.plib-header {
    display: flex;
    align-items: flex-start;
    gap: 1.5rem;
    padding: 1.5rem;
    background: var(--plib-surface, #1a1a1a);
    border-radius: var(--plib-radius, 12px);
    box-shadow: var(--plib-shadow, none);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.plib-header-avatar {
    flex-shrink: 0;
}

.plib-profile-image-wrapper {
    position: relative;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    overflow: hidden;
    box-shadow: var(--plib-shadow, none);
    /* Decorative ring with customizable gradient */
    padding: 3px;
    background: linear-gradient(135deg, var(--plib-ring-color-1, #2563eb), var(--plib-ring-color-2, #1d4ed8));
}

.plib-profile-image-wrapper::before {
    content: '';
    position: absolute;
    inset: 3px;
    border-radius: 50%;
    background: var(--plib-background, #0f0f0f);
}

.plib-profile-image-wrapper .plib-profile-image {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.plib-header-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
}

.plib-display-name {
    font-size: 1.375rem;
    font-weight: 700;
    color: var(--plib-text-primary, #ffffff);
    letter-spacing: -0.02em;
    margin: 0;
    line-height: 1.2;
}

.plib-bio {
    font-size: 0.875rem;
    color: var(--plib-text-secondary, #a0a0a0);
    line-height: 1.5;
}

.plib-bio p {
    margin-bottom: 0.375rem;
}

.plib-bio p:last-child {
    margin-bottom: 0;
}

.plib-bio a {
    color: var(--plib-button-bg, #2563eb);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.plib-bio a:hover {
    color: var(--plib-button-hover, #1d4ed8);
}

/* Mobile: Stack header vertically */
@media (max-width: 480px) {
    .plib-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 1rem;
        padding: 1.25rem;
    }
    
    .plib-header-content {
        align-items: center;
    }
    
    .plib-social-icons {
        justify-content: center;
    }
}

/* ==========================================================================
   Social Icons
   ========================================================================== */

.plib-social-icons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.plib-social-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: calc(var(--plib-radius, 12px) * 0.6);
    background: rgba(255, 255, 255, 0.05);
    color: var(--plib-text-secondary, #a0a0a0);
    transition: all 0.2s ease;
}

.plib-social-icon svg {
    width: 18px;
    height: 18px;
}

.plib-social-icon:hover {
    background: var(--plib-button-bg, #2563eb);
    color: var(--plib-button-text, #ffffff);
    transform: translateY(-2px);
}

.plib-social-icon:focus {
    outline: 2px solid var(--plib-button-bg, #2563eb);
    outline-offset: 2px;
}

.plib-social-icon:active {
    transform: scale(0.95);
}

/* ==========================================================================
   Featured Section
   ========================================================================== */

.plib-featured {
    width: 100%;
}

.plib-featured-card {
    display: flex;
    flex-direction: column;
    background: var(--plib-surface, #1a1a1a);
    border-radius: var(--plib-radius, 12px);
    overflow: hidden;
    box-shadow: var(--plib-shadow, none);
    /* Subtle border for definition */
    border: 1px solid rgba(255, 255, 255, 0.05);
    position: relative;
}

/* Featured glow effect */
.plib-featured-card.plib-has-glow {
    box-shadow: 0 0 60px var(--plib-featured-glow, rgba(37, 99, 235, 0.4)),
                0 0 100px var(--plib-featured-glow, rgba(37, 99, 235, 0.2));
}

.plib-featured-card.plib-has-glow::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(135deg, var(--plib-featured-glow, #2563eb), transparent, var(--plib-featured-glow, #2563eb));
    border-radius: calc(var(--plib-radius, 12px) + 2px);
    z-index: -1;
    opacity: 0.5;
    filter: blur(8px);
}

/* Featured stroke/border effect */
.plib-featured-card.plib-has-stroke {
    border: var(--plib-featured-stroke-width, 3px) solid transparent;
    background-image: linear-gradient(var(--plib-surface, #1a1a1a), var(--plib-surface, #1a1a1a)), 
                      linear-gradient(135deg, var(--plib-featured-stroke-start, #FF0080), var(--plib-featured-stroke-end, #7928CA));
    background-origin: border-box;
    background-clip: padding-box, border-box;
}

/* When both glow and stroke are active */
.plib-featured-card.plib-has-glow.plib-has-stroke::before {
    top: calc(var(--plib-featured-stroke-width, 3px) * -1 - 2px);
    left: calc(var(--plib-featured-stroke-width, 3px) * -1 - 2px);
    right: calc(var(--plib-featured-stroke-width, 3px) * -1 - 2px);
    bottom: calc(var(--plib-featured-stroke-width, 3px) * -1 - 2px);
}

.plib-featured-image-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.2);
}

.plib-featured-image-wrapper .plib-featured-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.plib-featured-content {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.plib-featured-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--plib-text-primary, #ffffff);
    letter-spacing: -0.01em;
}

.plib-featured-description {
    font-size: 0.875rem;
    color: var(--plib-text-secondary, #a0a0a0);
    line-height: 1.5;
}

.plib-featured-description p {
    margin-bottom: 0.5rem;
}

.plib-featured-description p:last-child {
    margin-bottom: 0;
}

.plib-featured-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    margin-top: 0.5rem;
    background: var(--plib-button-bg, #2563eb);
    color: var(--plib-button-text, #ffffff);
    font-size: 0.9375rem;
    font-weight: 500;
    border-radius: calc(var(--plib-radius, 12px) * 0.6);
    transition: all 0.2s ease;
    align-self: flex-start;
}

.plib-featured-cta:hover {
    background: var(--plib-button-hover, #1d4ed8);
    transform: translateX(4px);
}

.plib-featured-cta:focus {
    outline: 2px solid var(--plib-button-bg, #2563eb);
    outline-offset: 2px;
}

.plib-cta-arrow {
    width: 18px;
    height: 18px;
    transition: transform 0.2s ease;
}

.plib-featured-cta:hover .plib-cta-arrow {
    transform: translateX(2px);
}

/* Desktop: Two-column layout for featured */
@media (min-width: 640px) {
    .plib-featured-card {
        flex-direction: row;
    }
    
    .plib-featured-image-wrapper {
        flex: 0 0 40%;
        aspect-ratio: auto;
        min-height: 180px;
    }
    
    .plib-featured-content {
        flex: 1;
        padding: 1.5rem;
        justify-content: center;
    }
}

/* ==========================================================================
   Links Section
   ========================================================================== */

.plib-links {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    width: 100%;
}

.plib-link-section {
    display: flex;
    flex-direction: column;
    gap: 0.875rem;
}

.plib-section-title {
    font-size: 0.8125rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--plib-text-secondary, #a0a0a0);
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.plib-link-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.plib-link-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    width: 100%;
    padding: 1rem 1.25rem;
    background: var(--link-bg, var(--plib-button-bg, #2563eb));
    color: var(--link-text, var(--plib-button-text, #ffffff));
    font-size: 0.9375rem;
    font-weight: 500;
    text-align: center;
    border-radius: var(--plib-radius, 12px);
    transition: all 0.2s ease;
    box-shadow: var(--plib-shadow, none);
    position: relative;
    overflow: hidden;
}

/* Solid color - no gradient */

.plib-link-button:hover {
    background: var(--plib-button-hover, #1d4ed8);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px -8px rgba(0, 0, 0, 0.4);
}

.plib-link-button:focus {
    outline: 2px solid var(--plib-text-primary, #ffffff);
    outline-offset: 2px;
}

.plib-link-button:active {
    transform: scale(0.98);
}

.plib-link-button .dashicons {
    font-size: 20px;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.plib-link-button .plib-link-icon {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    border-radius: 4px;
}

.plib-link-label {
    flex: 1;
    text-align: center;
}

/* ==========================================================================
   Card-Style Links
   ========================================================================== */

.plib-link-card {
    display: flex;
    flex-direction: column;
    background: var(--plib-surface, #1a1a1a);
    border-radius: var(--plib-radius, 12px);
    overflow: hidden;
    box-shadow: var(--plib-shadow, none);
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.plib-link-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px -8px rgba(0, 0, 0, 0.4);
}

/* 16:9 (Widescreen) ratio - default */
.plib-link-card.plib-ratio-wide .plib-link-card-image {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.2);
}

/* 1:1 (Square) ratio */
.plib-link-card.plib-ratio-square .plib-link-card-image {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.2);
}

/* Fallback for cards without ratio class */
.plib-link-card-image {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.2);
}

.plib-link-card-image .plib-card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.plib-link-card:hover .plib-card-img {
    transform: scale(1.02);
}

.plib-link-card-content {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
}

.plib-link-card-title {
    font-size: 1.0625rem;
    font-weight: 600;
    color: var(--plib-text-primary, #ffffff);
    letter-spacing: -0.01em;
    margin: 0;
}

.plib-link-card-description {
    font-size: 0.8125rem;
    color: var(--plib-text-secondary, #a0a0a0);
    line-height: 1.5;
}

.plib-link-card-description p {
    margin-bottom: 0.375rem;
}

.plib-link-card-description p:last-child {
    margin-bottom: 0;
}

.plib-link-card-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    margin-top: 0.375rem;
    background: var(--plib-button-bg, #2563eb);
    color: var(--plib-button-text, #ffffff);
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: calc(var(--plib-radius, 12px) * 0.5);
    transition: all 0.2s ease;
    align-self: flex-start;
}

.plib-link-card-cta:hover {
    background: var(--plib-button-hover, #1d4ed8);
}

.plib-link-card-cta:focus {
    outline: 2px solid var(--plib-button-bg, #2563eb);
    outline-offset: 2px;
}

.plib-link-card-cta .plib-cta-arrow {
    width: 16px;
    height: 16px;
    transition: transform 0.2s ease;
}

.plib-link-card-cta:hover .plib-cta-arrow {
    transform: translateX(2px);
}

/* Card without image - narrower padding */
.plib-link-card:not(:has(.plib-link-card-image)) .plib-link-card-content {
    padding: 1rem 1.25rem;
}

/* Desktop layouts for card styles */
@media (min-width: 640px) {
    /* 16:9 Wide cards: stacked layout (full-width image on top) */
    .plib-link-card.plib-ratio-wide {
        flex-direction: column;
    }
    
    /* 1:1 Square cards: side-by-side layout on desktop */
    .plib-link-card.plib-ratio-square {
        flex-direction: row;
    }
    
    .plib-link-card.plib-ratio-square .plib-link-card-image {
        flex: 0 0 40%;
        min-height: 140px;
    }
    
    .plib-link-card.plib-ratio-square .plib-link-card-content {
        flex: 1;
        justify-content: center;
    }
}

/* ==========================================================================
   Footer
   ========================================================================== */

.plib-footer {
    margin-top: auto;
    padding-top: 2rem;
    text-align: center;
}

.plib-footer p {
    font-size: 0.8125rem;
    color: var(--plib-text-secondary, #a0a0a0);
    opacity: 0.7;
}

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

/* Focus visible for keyboard navigation */
.plib-body *:focus-visible {
    outline: 2px solid var(--plib-button-bg, #2563eb);
    outline-offset: 2px;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .plib-body *,
    .plib-body *::before,
    .plib-body *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ==========================================================================
   Mobile Optimizations
   ========================================================================== */

@media (max-width: 480px) {
    .plib-wrapper {
        padding: 1.5rem 1rem 2.5rem;
    }
    
    .plib-container {
        gap: 1.5rem;
    }
    
    .plib-profile-image-wrapper {
        width: 88px;
        height: 88px;
    }
    
    .plib-display-name {
        font-size: 1.375rem;
    }
    
    .plib-social-icon {
        width: 40px;
        height: 40px;
    }
    
    .plib-social-icon svg {
        width: 18px;
        height: 18px;
    }
    
    .plib-link-button {
        padding: 0.875rem 1rem;
        font-size: 0.875rem;
    }
}

/* ==========================================================================
   Larger Screens
   ========================================================================== */

@media (min-width: 768px) {
    .plib-wrapper {
        padding: 3rem 2rem 4rem;
    }
    
    .plib-container {
        max-width: 520px;
        gap: 2rem;
    }
    
    .plib-profile-image-wrapper {
        width: 120px;
        height: 120px;
    }
    
    .plib-display-name {
        font-size: 1.75rem;
    }
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
    .plib-body {
        background: white;
        color: black;
    }
    
    .plib-link-button,
    .plib-social-icon,
    .plib-featured-cta {
        background: white;
        color: black;
        border: 1px solid black;
    }
    
    .plib-bg-canvas {
        display: none !important;
    }
}

/* ==========================================================================
   Background Effects
   ========================================================================== */

.plib-bg-canvas {
    position: fixed;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: -1;
}

/* Wrapper needs to be above canvas */
.plib-wrapper {
    position: relative;
    z-index: 1;
}

