/* Custom styles */

/* Animations */
@keyframes fade-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in {
    animation: fade-in 0.6s ease-out;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.animate-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* 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;
}

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

/* Prose styles for markdown content */
.prose {
    color: #b4b4b4;
    line-height: 1.8;
    font-size: 1.125rem;
}

.prose h1, .prose h2, .prose h3, .prose h4, .prose h5, .prose h6 {
    color: #ffffff;
    font-weight: 700;
    margin-top: 2em;
    margin-bottom: 1em;
    line-height: 1.3;
}

.prose h1 { font-size: 2.5em; }
.prose h2 { font-size: 2em; }
.prose h3 { font-size: 1.5em; }
.prose h4 { font-size: 1.25em; }

.prose p {
    margin-bottom: 1.5em;
}

.prose p:has(> img:only-child) {
    text-align: center;
    margin: 2em auto;
}

.prose a {
    color: #a78bfa;
    text-decoration: none;
    border-bottom: 1px solid #8b5cf6;
    transition: color 0.2s, border-color 0.2s;
}

.prose a:hover {
    color: #8b5cf6;
    border-color: #7c3aed;
}

.prose strong {
    color: #ffffff;
    font-weight: 700;
}

.prose code {
    background: #1a1a1a;
    padding: 0.2em 0.4em;
    border-radius: 6px;
    font-size: 0.9em;
    font-family: 'JetBrains Mono', monospace;
    color: #a78bfa;
    border: 1px solid #1f1f1f;
}

.prose pre {
    background: #1a1a1a;
    border: 1px solid #1f1f1f;
    border-radius: 12px;
    padding: 1.5em;
    overflow-x: auto;
    margin: 2em 0;
}

.prose pre code {
    background: none;
    padding: 0;
    font-size: 0.875em;
    line-height: 1.6;
    border: none;
    color: inherit;
}

.prose blockquote {
    border-left: 4px solid #8b5cf6;
    padding-left: 1.5em;
    margin-left: 0;
    color: #808080;
    font-style: italic;
    background: #1a1a1a;
    padding: 1em 1.5em;
    border-radius: 8px;
}

.prose ul, .prose ol {
    padding-left: 1.5em;
    margin-bottom: 1.5em;
}

.prose li {
    margin-bottom: 0.75em;
}

.prose ul {
    list-style-type: disc;
}

.prose ol {
    list-style-type: decimal;
}

.prose hr {
    border: none;
    border-top: 1px solid #1f1f1f;
    margin: 3em 0;
}

.prose img {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    margin: 2em auto !important;
    border: 1px solid #1f1f1f;
    display: block !important;
    margin-left: auto !important;
    margin-right: auto !important;
}

.prose p img,
.prose figure img,
.prose div img {
    display: block !important;
    margin-left: auto !important;
    margin-right: auto !important;
    margin-top: 2em !important;
    margin-bottom: 2em !important;
}

.prose p:has(img) {
    text-align: center !important;
}

.prose figure {
    margin: 2em auto !important;
    text-align: center !important;
    display: block;
}

.prose figure img {
    margin: 0 auto !important;
}

.prose div:has(> img) {
    text-align: center !important;
}

.prose table {
    width: 100%;
    border-collapse: collapse;
    margin: 2em 0;
    border: 1px solid #1f1f1f;
    border-radius: 8px;
    overflow: hidden;
}

.prose th, .prose td {
    border: 1px solid #1f1f1f;
    padding: 0.75em 1em;
    text-align: left;
}

.prose th {
    background: #1a1a1a;
    font-weight: 700;
    color: #ffffff;
}

/* Code block wrapper */
.code-block {
    position: relative;
    margin: 2em 0;
}

.code-block::before {
    content: attr(data-language);
    position: absolute;
    top: 0;
    right: 0;
    padding: 0.25em 0.75em;
    font-size: 0.75em;
    color: #808080;
    background: #1a1a1a;
    border-radius: 0 12px 0 8px;
    text-transform: uppercase;
    font-family: 'JetBrains Mono', monospace;
}

/* Task list checkboxes */
.prose input[type="checkbox"] {
    appearance: none;
    width: 1.1em;
    height: 1.1em;
    border: 2px solid #404040;
    border-radius: 4px;
    margin-right: 0.5em;
    vertical-align: middle;
    cursor: default;
}

.prose input[type="checkbox"]:checked {
    background: #8b5cf6;
    border-color: #8b5cf6;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12.207 4.793a1 1 0 010 1.414l-5 5a1 1 0 01-1.414 0l-2-2a1 1 0 011.414-1.414L6.5 9.086l4.293-4.293a1 1 0 011.414 0z'/%3E%3C/svg%3E");
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: #0f0f0f;
}

::-webkit-scrollbar-thumb {
    background: #1f1f1f;
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: #2a2a2a;
}

/* Selection */
::selection {
    background: #8b5cf6;
    color: white;
}

/* ================================
   Carousel styles
   ================================ */
.carousel {
    position: relative;
    margin: 2em 0;
    border-radius: 12px;
    overflow: hidden;
    background: #1a1a1a;
    border: 1px solid #1f1f1f;
}

.carousel-container {
    position: relative;
}

.carousel-slides {
    display: flex;
    transition: transform 0.4s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.carousel-slide {
    flex: 0 0 100%;
    display: none;
}

.carousel-slide.carousel-slide-active {
    display: block;
}

.carousel-slide img {
    width: 100%;
    height: auto;
    max-height: 70vh;
    object-fit: contain;
    display: block;
    margin: 0;
}

/* Navigation buttons */
.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    background: rgba(15, 15, 15, 0.9);
    border: 1px solid #1f1f1f;
    border-radius: 50%;
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    z-index: 10;
    backdrop-filter: blur(4px);
}

.carousel-btn:hover {
    background: rgba(139, 92, 246, 0.8);
    border-color: #8b5cf6;
}

.carousel-btn svg {
    width: 24px;
    height: 24px;
}

.carousel-btn-prev {
    left: 16px;
}

.carousel-btn-next {
    right: 16px;
}

/* Indicators */
.carousel-indicators {
    display: flex;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    background: rgba(15, 15, 15, 0.9);
    border-top: 1px solid #1f1f1f;
}

.carousel-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #404040;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    padding: 0;
}

.carousel-dot:hover {
    background: #808080;
}

.carousel-dot.carousel-dot-active {
    background: #8b5cf6;
    transform: scale(1.2);
}

/* Touch/swipe support via CSS scroll snap */
@media (hover: none) {
    .carousel-slides {
        display: flex;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }
    
    .carousel-slides::-webkit-scrollbar {
        display: none;
    }
    
    .carousel-slide {
        scroll-snap-align: start;
        display: block;
    }
    
    .carousel-btn {
        display: none;
    }
}
