/* Custom CSS for Connecting Dots Affiliate Lab */

/* Line clamp utilities for text truncation */
.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;
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Custom hover effects */
.hover-lift {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hover-lift:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* Custom gradient animations */
@keyframes gradient-x {
    0%, 100% {
        transform: translateX(0%);
    }
    50% {
        transform: translateX(100%);
    }
}

.animate-gradient-x {
    animation: gradient-x 15s ease infinite;
    background-size: 400% 400%;
}

/* Custom button styles */
.btn-primary {
    @apply bg-blue-600 text-white px-6 py-3 rounded-full font-medium hover:bg-blue-700 transition-all duration-200 transform hover:scale-105;
}

.btn-secondary {
    @apply border-2 border-blue-600 text-blue-600 px-6 py-3 rounded-full font-medium hover:bg-blue-600 hover:text-white transition-all duration-200;
}

/* Search input styling */
.search-input-focus:focus {
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Navigation dropdown animations */
.nav-dropdown {
    transform: translateY(-10px);
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
}

.nav-dropdown.show {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
}

/* Article card hover effects */
.article-card {
    transition: all 0.3s ease;
}

.article-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

/* Affiliate section styling */
.affiliate-card {
    transition: all 0.3s ease;
}

.affiliate-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

/* Loading animation for dynamic content */
.loading-spinner {
    border: 4px solid #f3f4f6;
    border-top: 4px solid #3b82f6;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 2s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

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

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

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Print styles */
@media print {
    .no-print {
        display: none !important;
    }
    
    body {
        font-size: 12pt;
        line-height: 1.6;
    }
    
    h1, h2, h3, h4, h5, h6 {
        page-break-after: avoid;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .text-gray-600 {
        color: #374151 !important;
    }
    
    .text-gray-500 {
        color: #4b5563 !important;
    }
}

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

/* Focus styles for accessibility */
.focus-visible:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* Custom utility classes */
.text-shadow {
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.glass-effect {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Mobile-specific styles */
@media (max-width: 640px) {
    .mobile-padding {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    .mobile-text-sm {
        font-size: 0.875rem;
    }
}

/* Tablet-specific styles */
@media (min-width: 641px) and (max-width: 1024px) {
    .tablet-grid-2 {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Desktop-specific styles */
@media (min-width: 1025px) {
    .desktop-grid-4 {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Enhanced Article Content Styling */
.article-content {
    font-family: 'Noto Sans JP', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.8;
    color: #374151;
    letter-spacing: 0.02em;
}

.article-content h1,
.article-content h2,
.article-content h3,
.article-content h4,
.article-content h5,
.article-content h6 {
    font-weight: 700;
    letter-spacing: -0.025em;
    scroll-margin-top: 100px;
    position: relative;
}

.article-content h1::before,
.article-content h2::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: linear-gradient(90deg, #3b82f6, #8b5cf6);
    border-radius: 2px;
    animation: slideIn 0.8s ease-out;
}

.article-content h1::before {
    width: 80px;
}

.article-content h2::before {
    width: 60px;
}

@keyframes slideIn {
    from {
        width: 0;
    }
    to {
        width: inherit;
    }
}

.article-content p {
    margin-bottom: 1.75rem;
    text-align: justify;
    text-justify: inter-ideograph;
    font-size: 1.125rem;
}

.article-content img {
    border-radius: 16px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    margin: 3rem auto;
    max-width: 100%;
    height: auto;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.article-content img:hover {
    transform: scale(1.02);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.article-content code {
    background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
    color: #dc2626;
    padding: 0.375rem 0.75rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
    border: 1px solid #d1d5db;
}

.article-content pre {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    color: #f8fafc;
    padding: 2rem;
    border-radius: 16px;
    overflow-x: auto;
    margin: 3rem 0;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3);
    border: 1px solid #334155;
}

.article-content pre code {
    background: none;
    color: inherit;
    padding: 0;
    border-radius: 0;
    font-size: inherit;
    border: none;
}

.article-content blockquote {
    position: relative;
    padding-left: 2rem;
    font-style: italic;
    font-size: 1.1em;
    line-height: 1.7;
}

.article-content blockquote::before {
    content: '"';
    position: absolute;
    left: 0;
    top: -10px;
    font-size: 4rem;
    color: #3b82f6;
    font-family: serif;
    line-height: 1;
}

.article-content table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 3rem 0;
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
}

.article-content th {
    background: linear-gradient(135deg, #1e40af 0%, #3b82f6 50%, #6366f1 100%);
    color: white;
    font-weight: 700;
    padding: 1.25rem;
    text-align: left;
    font-size: 1rem;
    letter-spacing: 0.025em;
}

.article-content td {
    padding: 1.25rem;
    border-bottom: 1px solid #f3f4f6;
    font-size: 1rem;
    transition: background-color 0.2s ease;
}

.article-content tbody tr:hover td {
    background-color: #f8fafc;
}

.article-content tbody tr:last-child td {
    border-bottom: none;
}

/* Enhanced List Styling */
.article-content ul li {
    position: relative;
    padding-left: 0;
    margin-bottom: 0.75rem;
}

.article-content ul li i {
    color: #10b981;
    font-size: 1.1rem;
    margin-right: 0.75rem;
}

.article-content ol li {
    padding-left: 0.5rem;
    margin-bottom: 0.75rem;
    font-size: 1.1rem;
}

/* Reading Progress Indicator */
.reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, #3b82f6, #8b5cf6, #ec4899);
    transform-origin: left;
    z-index: 1000;
}

/* Responsive Article Typography */
@media (max-width: 640px) {
    .article-content {
        font-size: 16px;
        line-height: 1.7;
    }
    
    .article-content p {
        font-size: 1rem;
        margin-bottom: 1.5rem;
    }
    
    .article-content h1 {
        font-size: 1.875rem;
        margin-bottom: 1.5rem;
    }
    
    .article-content h2 {
        font-size: 1.5rem;
        margin-top: 2.5rem;
        margin-bottom: 1rem;
    }
    
    .article-content h3 {
        font-size: 1.25rem;
        margin-top: 2rem;
        margin-bottom: 0.75rem;
    }
    
    .article-content img {
        margin: 2rem auto;
    }
    
    .article-content pre {
        padding: 1.5rem;
        margin: 2rem 0;
        border-radius: 12px;
    }
    
    .article-content table {
        font-size: 0.875rem;
    }
    
    .article-content th,
    .article-content td {
        padding: 0.875rem;
    }
}