/* Мед Бот SEO Site - Custom Styles */

/* ===== Base Styles ===== */
:root {
    --primary-50: #eff6ff;
    --primary-100: #dbeafe;
    --primary-500: #3b82f6;
    --primary-600: #2563eb;
    --primary-700: #1d4ed8;
    --accent-500: #10b981;
}

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

/* Selection color */
::selection {
    background-color: var(--primary-100);
    color: var(--primary-700);
}

/* ===== Typography ===== */
.prose {
    font-size: 1.0625rem;
    line-height: 1.75;
    color: #1e293b;
}

.prose h1 {
    font-size: 2.5rem;
    font-weight: 800;
    line-height: 1.2;
    color: #0f172a;
    margin-bottom: 1.5rem;
    letter-spacing: -0.025em;
}

.prose h2 {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.3;
    color: #1e293b;
    margin-top: 3rem;
    margin-bottom: 1.5rem;
    scroll-margin-top: 5rem;
    padding-top: 1rem;
    border-top: 1px solid #e2e8f0;
}

.prose h2:first-of-type {
    border-top: none;
    margin-top: 2rem;
}

.prose h3 {
    font-size: 1.5rem;
    font-weight: 600;
    line-height: 1.4;
    color: #334155;
    margin-top: 2rem;
    margin-bottom: 1rem;
    scroll-margin-top: 5rem;
}

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

/* Highlight key metrics and numbers */
.prose strong {
    font-weight: 700;
    color: #1e40af;
}

/* Emphasis for leads */
.prose em {
    font-style: italic;
    color: #475569;
    font-size: 1.125rem;
}

/* Inline code for technical terms */
.prose code:not(pre code) {
    background-color: #f1f5f9;
    color: #3730a3;
    padding: 0.2em 0.4em;
    border-radius: 0.25rem;
    font-size: 0.9em;
    font-weight: 500;
}

/* Line clamp utility */
.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;
}

/* Hide scrollbar but keep functionality */
.scrollbar-hide {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.scrollbar-hide::-webkit-scrollbar {
    display: none;
}

/* ===== Sticky CTA Animation ===== */
#sticky-cta {
    transition: transform 0.3s ease, opacity 0.3s ease;
}

#sticky-cta.visible {
    transform: translateY(0);
    opacity: 1;
}

#sticky-cta:not(.visible) {
    transform: translateY(-100%);
    opacity: 0;
}

/* ===== Header Dropdown ===== */
.group:hover .group-hover\:opacity-100 {
    opacity: 1;
    visibility: visible;
}

.group:hover .group-hover\:visible {
    visibility: visible;
}

/* ===== Article Content ===== */
.prose {
    max-width: 65ch;
}

.prose > :first-child {
    margin-top: 0;
}

.prose > :last-child {
    margin-bottom: 0;
}

/* Code blocks */
.prose pre {
    background-color: #1f2937;
    color: #f3f4f6;
    border-radius: 0.5rem;
    padding: 1rem;
    overflow-x: auto;
}

.prose code {
    font-size: 0.875em;
}

/* Blockquotes */
.prose blockquote {
    border-left-width: 0;
    padding: 1.25rem 1.5rem;
    margin: 2rem 0;
    font-style: normal;
    border-radius: 12px;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border: 2px solid #bae6fd;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.08);
    position: relative;
}

/* Icon before blockquote */
.prose blockquote::before {
    content: "💡";
    position: absolute;
    top: 1rem;
    left: 1.5rem;
    font-size: 1.5rem;
    line-height: 1;
}

.prose blockquote p {
    margin-left: 2.5rem;
    margin-bottom: 0;
    font-size: 1.0625rem;
    line-height: 1.7;
    color: #0c4a6e;
}

/* Warning blockquotes */
.prose blockquote:has(*:first-child:contains("⚠️")) {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border-color: #fbbf24;
}

.prose blockquote:has(*:first-child:contains("⚠️"))::before {
    content: "⚠️";
}

/* Insight blockquotes */
.prose blockquote:has(*:first-child:contains("Ключевой инсайт")) {
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
    border-color: #6ee7b7;
}

.prose blockquote:has(*:first-child:contains("Ключевой инсайт"))::before {
    content: "✨";
}

.prose blockquote strong {
    color: #1e3a8a;
    font-weight: 700;
}

/* Tables */
.prose table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    margin: 2rem 0;
}

.prose th,
.prose td {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #e5e7eb;
    text-align: left;
}

.prose th {
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
    font-weight: 700;
    font-size: 0.9375rem;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    color: #475569;
    border-bottom: 2px solid #cbd5e1;
}

.prose tbody tr {
    transition: background-color 0.15s ease;
}

.prose tbody tr:hover {
    background-color: #f8fafc;
}

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

/* Highlight best options in tables */
.prose td strong {
    color: #2563eb;
    font-weight: 700;
}

/* Lists */
.prose ul {
    list-style-type: none;
    padding-left: 0;
    margin: 1.5rem 0;
}

.prose ol {
    list-style-type: none;
    padding-left: 0;
    margin: 1.5rem 0;
    counter-reset: list-counter;
}

.prose ul > li {
    position: relative;
    padding-left: 2rem;
    margin-bottom: 0.75rem;
    line-height: 1.7;
}

.prose ul > li::before {
    content: "→";
    position: absolute;
    left: 0;
    color: #2563eb;
    font-weight: 700;
    font-size: 1.25rem;
}

.prose ol > li {
    position: relative;
    padding-left: 2rem;
    margin-bottom: 0.75rem;
    counter-increment: list-counter;
    line-height: 1.7;
}

.prose ol > li::before {
    content: counter(list-counter) ".";
    position: absolute;
    left: 0;
    color: #2563eb;
    font-weight: 700;
}

/* Checkbox lists */
.prose ul:has(li > input[type="checkbox"]) {
    padding-left: 0;
}

.prose ul input[type="checkbox"] {
    margin-right: 0.5rem;
    cursor: pointer;
}

/* Nested lists */
.prose ul ul,
.prose ol ul,
.prose ul ol,
.prose ol ol {
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
}

/* Links */
.prose a {
    color: #2563eb;
    text-decoration: none;
    font-weight: 500;
    border-bottom: 2px solid #bfdbfe;
    transition: all 0.2s ease;
}

.prose a:hover {
    color: #1e40af;
    border-bottom-color: #2563eb;
    background-color: #eff6ff;
}

/* Horizontal rules */
.prose hr {
    border: none;
    height: 2px;
    background: linear-gradient(90deg, transparent, #cbd5e1, transparent);
    margin: 3rem 0;
}

/* Images */
.prose img {
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

/* ===== CTA Components ===== */
[data-cta] {
    cursor: pointer;
}

/* In-article CTA hover */
[data-cta="in-article"]:hover {
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
}

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

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

/* ===== Background Patterns ===== */
.bg-grid-white\/10 {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40' viewBox='0 0 40 40'%3E%3Cg fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.1'%3E%3Cpath d='M0 38.59l2.83-2.83 1.41 1.41L1.41 40H0v-1.41zM0 1.4l2.83 2.83 1.41-1.41L1.41 0H0v1.41zM38.59 40l-2.83-2.83 1.41-1.41L40 38.59V40h-1.41zM40 1.41l-2.83 2.83-1.41-1.41L38.59 0H40v1.41zM20 18.6l2.83-2.83 1.41 1.41L21.41 20l2.83 2.83-1.41 1.41L20 21.41l-2.83 2.83-1.41-1.41L18.59 20l-2.83-2.83 1.41-1.41L20 18.59z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

/* ===== Form Styles ===== */
input:focus,
textarea:focus,
select:focus {
    outline: none;
    ring: 2px;
    ring-color: var(--primary-500);
}

/* Phone input mask placeholder */
input[type="tel"]::placeholder {
    color: #9ca3af;
}

/* ===== Responsive ===== */
@media (max-width: 640px) {
    .prose {
        font-size: 1rem;
    }

    .prose h2 {
        font-size: 1.5rem;
    }

    .prose h3 {
        font-size: 1.25rem;
    }
}

/* ===== Print Styles ===== */
@media print {
    /* Hide interactive elements */
    .print\:hidden,
    [data-cta],
    header,
    footer,
    #sticky-cta,
    aside {
        display: none !important;
    }

    /* Full width content */
    .prose {
        max-width: 100%;
    }

    /* Black text for readability */
    body {
        color: #000;
        background: #fff;
    }

    /* Show URLs for links */
    .prose a::after {
        content: " (" attr(href) ")";
        font-size: 0.8em;
        color: #666;
    }

    /* Page breaks */
    h2, h3 {
        page-break-after: avoid;
    }

    .prose img {
        page-break-inside: avoid;
    }
}

/* ===== Accessibility ===== */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    html {
        scroll-behavior: auto;
    }
}

/* Focus visible for keyboard navigation */
:focus-visible {
    outline: 2px solid var(--primary-500);
    outline-offset: 2px;
}

/* Skip link for accessibility */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--primary-600);
    color: white;
    padding: 8px 16px;
    z-index: 100;
}

.skip-link:focus {
    top: 0;
}

/* ===== Zen-style Article Cards ===== */

/* Image aspect ratio (16:9) */
.aspect-video {
    aspect-ratio: 16 / 9;
}

/* Image hover zoom effect */
.group:hover img {
    transform: scale(1.05);
}

/* Card shadow enhancement on hover */
.hover\:shadow-xl:hover {
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1),
                0 8px 10px -6px rgba(0, 0, 0, 0.1);
}

/* ===== Responsive Grid Adjustments ===== */

/* Mobile: 1 column */
@media (max-width: 639px) {
    #articles-grid {
        grid-template-columns: 1fr;
    }
}

/* Tablet: 2 columns */
@media (min-width: 640px) and (max-width: 1279px) {
    #articles-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Desktop: 3 columns */
@media (min-width: 1280px) {
    #articles-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

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

/* Placeholder background while image loads */
.aspect-video {
    background: linear-gradient(90deg, #f0f0f0 0%, #e0e0e0 50%, #f0f0f0 100%);
    background-size: 200% 100%;
}

/* ===== Sidebar Styles ===== */

/* Sidebar sticky positioning */
.sidebar-sticky,
aside .sticky {
    position: sticky;
    top: 5rem;
}

/* CTA card gradient animation */
.sidebar-cta,
.bg-gradient-to-br {
    position: relative;
    overflow: hidden;
}

/* ===== FAQ Accordion ===== */
.faq-item summary { list-style: none; }
.faq-item[open] .faq-chevron { transform: rotate(180deg); }
.faq-item[open] { border-color: #bfdbfe; box-shadow: 0 2px 8px rgba(37, 99, 235, 0.08); }
.faq-item .faq-answer { animation: faqFadeIn 0.3s ease-out; }

@keyframes faqFadeIn {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
    .faq-item .faq-answer { animation: none; }
    .faq-chevron { transition: none; }
}

/* ===== Enhanced Article Typography ===== */

/* Lead paragraph (first paragraph after H1) */
.prose > p:first-of-type {
    font-size: 1.25rem;
    line-height: 1.6;
    color: #475569;
    margin-top: 1.5rem;
    margin-bottom: 2rem;
}

/* Quote arrows for better UX */
.prose blockquote p::before {
    content: '"';
    font-size: 2rem;
    color: #bae6fd;
    position: absolute;
    left: 0.5rem;
    top: 0.5rem;
    font-family: Georgia, serif;
}

/* Better spacing for paragraphs */
.prose > * + * {
    margin-top: 1.25rem;
}

.prose > * + h2 {
    margin-top: 3rem;
}

.prose > * + h3 {
    margin-top: 2rem;
}

/* Table of Contents styling */
.prose nav ol {
    border-left: 3px solid #e0f2fe;
    padding-left: 1.5rem;
    background: #f8fafc;
    padding: 1.5rem;
    border-radius: 8px;
}

.prose nav ol li {
    padding-left: 0;
}

.prose nav ol li::before {
    display: none;
}

/* Enhanced checklist styling */
.prose li:has(input[type="checkbox"]) {
    padding: 0.75rem 1rem;
    background: #f8fafc;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    border: 1px solid #e2e8f0;
    transition: all 0.2s ease;
}

.prose li:has(input[type="checkbox"]):hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

.prose li input[type="checkbox"] {
    width: 1.25rem;
    height: 1.25rem;
    margin-right: 0.75rem;
}

/* Better readability for large numbers */
.prose td:has(strong),
.prose p:has(strong) {
    font-feature-settings: "tnum";
    font-variant-numeric: tabular-nums;
}

/* ===== Article Table of Contents ===== */

/* Reset default list styling for TOC */
#article-toc .toc-content ul {
    list-style: none;
    padding-left: 0;
    margin: 0;
}

/* H2 level links */
#article-toc .toc-content > ul > li {
    margin-bottom: 0.75rem;
}

#article-toc .toc-content > ul > li > a {
    display: block;
    color: #1f2937;
    font-weight: 600;
    font-size: 0.9375rem;
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
    text-decoration: none;
    border-bottom: none;
}

#article-toc .toc-content > ul > li > a:hover {
    background-color: rgba(255, 255, 255, 0.8);
    color: #2563eb;
    transform: translateX(4px);
}

/* Active/current link */
#article-toc .toc-content a.active {
    background-color: rgba(37, 99, 235, 0.1);
    color: #2563eb;
}

/* Collapsed state on mobile */
#article-toc .toc-content.collapsed {
    display: none;
}

/* Desktop: always visible */
@media (min-width: 1024px) {
    #article-toc .toc-content.collapsed {
        display: block;
    }
}

/* Scroll offset for heading anchors */
html {
    scroll-padding-top: 100px;
}

/* Screen reader only - for accessible labels */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
