/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideInFromLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.content-page {
    min-height: 100vh;
    background-color: #0f172b;
    display: flex;
    flex-direction: column;
}

.content-container {
    max-width: 900px;
    margin: 0 auto;
    padding: clamp(60px, 10vw, 80px) clamp(16px, 5vw, 24px) clamp(32px, 6vw, 40px);
    flex-grow: 1;
    width: 100%;
}

.content-body {
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: clamp(12px, 2vw, 16px);
    padding: clamp(24px, 5vw, 60px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    animation: scaleIn 0.6s ease-out;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: box-shadow 0.3s ease;
    font-family: var(--font-family-inter);
    font-size: clamp(14px, 2vw, 16px);
    line-height: 1.8;
    color: var(--color-text-subtle);
}

/* Use this helper class on specific elements that need newline preservation. */
.content-body .preserve-whitespace {
    white-space: pre-line;
}

.content-body:hover {
    box-shadow: 0 8px 12px rgba(0, 0, 0, 0.15);
}

.content-body h1 {
    font-family: var(--font-family-jakarta);
    font-size: clamp(28px, 6vw, 48px);
    font-weight: 700;
    color: var(--color-white);
    margin-bottom: clamp(24px, 4vw, 32px);
    line-height: 1.2;
    animation: fadeInUp 0.8s ease-out 0.2s both;
    background: linear-gradient(135deg, #ffffff 0%, #e0e7ff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.content-body h2 {
    font-family: var(--font-family-jakarta);
    font-size: clamp(20px, 4vw, 32px);
    font-weight: 600;
    color: var(--color-white);
    margin-top: clamp(32px, 5vw, 40px);
    margin-bottom: clamp(12px, 2vw, 16px);
    line-height: 1.3;
    opacity: 0;
    animation: slideInFromLeft 0.6s ease-out forwards;
    animation-delay: 0.3s;
    position: relative;
    padding-left: 16px;
}

.content-body h2::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 60%;
    background: linear-gradient(180deg, var(--color-primary) 0%, #60a5fa 100%);
    border-radius: 2px;
}

.content-body p,
.content-body li {
    font-family: var(--font-family-inter);
    font-size: clamp(14px, 2vw, 16px);
    line-height: 1.8;
    color: var(--color-text-subtle);
    margin-top: 0;
    margin-bottom: clamp(12px, 2vw, 16px);
}

.content-body ul {
    margin-left: clamp(16px, 3vw, 24px);
    margin-bottom: clamp(16px, 3vw, 24px);
}

.content-body li {
    margin-bottom: clamp(8px, 1.5vw, 12px);
    position: relative;
}

.content-body ul>li::marker {
    color: var(--color-primary);
}

.content-body a {
    color: var(--color-primary);
    text-decoration: underline;
    transition: all 0.3s ease;
    position: relative;
}

.content-body a:hover {
    color: #60a5fa;
    text-decoration: none;
}

.content-body a::after {
    content: '→';
    margin-left: 4px;
    opacity: 0;
    transition: all 0.3s ease;
    display: inline-block;
    transform: translateX(-5px);
}

.content-body a:hover::after {
    opacity: 1;
    transform: translateX(0);
}

/* Scroll animations */
.animate-on-scroll {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.animate-on-scroll.animate-in {
    opacity: 1;
    transform: translateY(0);
}

/* Responsive breakpoints */
@media (max-width: 768px) {
    .content-body {
        padding: clamp(16px, 4vw, 24px);
    }

    .content-body h1 {
        font-size: 24px;
        margin-bottom: 20px;
    }

    .content-body h2 {
        font-size: 18px;
        margin-top: 24px;
        padding-left: 12px;
    }

    .content-body h2::before {
        width: 3px;
    }

    .content-body ul {
        margin-left: clamp(12px, 3vw, 16px);
    }

    .content-body table {
        font-size: 12px;
    }

    .content-body table th,
    .content-body table td {
        padding: 8px;
    }
}

@media (max-width: 480px) {
    .content-container {
        padding: 48px 16px 24px;
    }

    .content-body {
        border-radius: 12px;
    }

    .content-body h1 {
        font-size: 24px;
    }

    .content-body h2 {
        font-size: 18px;
    }

    .content-body p,
    .content-body li {
        font-size: 14px;
        line-height: 1.7;
    }
}

/* Scroll to top button */
.scroll-to-top {
    position: fixed;
    bottom: 32px;
    right: 32px;
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--color-primary) 0%, #60a5fa 100%);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
    z-index: 1000;
}

.scroll-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.scroll-to-top:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.4);
}

.scroll-to-top:active {
    transform: translateY(-2px);
}

.scroll-to-top svg {
    width: 24px;
    height: 24px;
    fill: white;
}

@media (max-width: 768px) {
    .scroll-to-top {
        bottom: 24px;
        right: 24px;
        width: 44px;
        height: 44px;
    }

    .scroll-to-top svg {
        width: 20px;
        height: 20px;
    }
}

.content-body h3 {
    font-family: var(--font-family-jakarta);
    font-size: clamp(16px, 2.5vw, 20px);
    font-weight: 600;
    color: #e0e7ff;
    margin-top: clamp(24px, 3vw, 28px);
    margin-bottom: clamp(10px, 1.5vw, 14px);
    padding-left: 12px;
    border-left: 3px solid #60a5fa;
}

.content-body strong {
    color: #e0e7ff;
    font-weight: 600;
}

.content-body em {
    color: #cbd5e1;
    font-style: italic;
}

.content-body code {
    background-color: rgba(59, 130, 246, 0.1);
    color: #60a5fa;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.95em;
}

.content-body blockquote {
    border-left: 4px solid #3b82f6;
    padding-left: clamp(16px, 2vw, 20px);
    margin-left: 0;
    color: #cbd5e1;
    font-style: italic;
    margin: clamp(16px, 2vw, 20px) 0;
}

.content-body ol {
    margin-left: clamp(20px, 3vw, 28px);
    margin-bottom: clamp(16px, 3vw, 24px);
}

.content-body ol>li {
    margin-bottom: clamp(8px, 1.5vw, 12px);
}

.content-body ol>li::marker {
    color: #60a5fa;
    font-weight: 600;
}

.content-body table {
    width: 100%;
    border-collapse: collapse;
    margin: clamp(16px, 2vw, 24px) 0;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    overflow: hidden;
}

.content-body table th {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.15) 0%, rgba(96, 165, 250, 0.1) 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: clamp(12px, 1.5vw, 16px);
    text-align: left;
    font-weight: 600;
    color: #e0e7ff;
}

.content-body table td {
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: clamp(10px, 1.5vw, 14px);
    color: #cbd5e1;
}

.content-body table tr:hover {
    background-color: rgba(59, 130, 246, 0.05);
}

.content-body hr {
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin: clamp(24px, 3vw, 32px) 0;
}

.content-body dl {
    margin: clamp(16px, 2vw, 20px) 0;
}

.content-body dt {
    font-weight: 600;
    color: #e0e7ff;
    margin-top: clamp(12px, 1.5vw, 16px);
    margin-bottom: 4px;
}

.content-body dd {
    margin-left: clamp(16px, 2vw, 20px);
    margin-bottom: clamp(8px, 1.5vw, 12px);
    color: #cbd5e1;
}

/* Enhanced link styling within content */
.content-body a.enhanced-link {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.2) 0%, rgba(96, 165, 250, 0.1) 100%);
    border-radius: 3px;
    padding: 1px 4px;
    transition: all 0.2s ease;
}

.content-body a.enhanced-link:hover {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.3) 0%, rgba(96, 165, 250, 0.2) 100%);
}

/* Section numbering and structure */
.content-body>h2:first-of-type {
    margin-top: clamp(24px, 4vw, 32px);
}

.content-body>h2 {
    margin-top: clamp(22px, 3vw, 28px);
    scroll-margin-top: 100px;
}

.content-body>h2+p {
    margin-top: 0;
}

.content-body>h3 {
    margin-top: clamp(24px, 3vw, 28px);
}

/* Print styles */
@media print {
    .content-body {
        background-color: white;
        border: none;
        color: #000;
    }

    /* Reset gradient/text-fill for WebKit so H1 prints as solid black */
    .content-body h1 {
        background: none !important;
        -webkit-text-fill-color: #000 !important;
        -webkit-background-clip: border-box !important;
    }

    .content-body h1,
    .content-body h2,
    .content-body h3 {
        color: #000;
        page-break-after: avoid;
    }

    .content-body p,
    .content-body ul,
    .content-body ol {
        page-break-inside: avoid;
    }
}
