/* styles.css */

:root {
    --color-navy: #1f2937;
    --color-navy-light: #374151;
    --color-text: #4b5563;
    --color-text-light: #6b7280;
    --color-background: #ffffff;
    --color-background-alt: #f3f4f6;
    --color-border: #e5e7eb;
    --color-accent: #3b82f6;
    --color-accent-hover: #2563eb;

    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;

    --max-width: 825px;
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2.5rem;
    --spacing-xl: 4rem;
}

/* Dark mode colors */
[data-theme="dark"] {
    --color-navy: #e5e7eb;
    --color-navy-light: #d1d5db;
    --color-text: #d1d5db;
    --color-text-light: #9ca3af;
    --color-background: #0f172a;
    --color-background-alt: #1f2937;
    --color-border: #374151;
    --color-accent: #60a5fa;
    --color-accent-hover: #93c5fd;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 80px;
    /* Offset for sticky header */
}

body {
    font-family: var(--font-sans);
    font-size: 18px;
    line-height: 1.8;
    color: var(--color-text);
    background-color: var(--color-background);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Progress Bar */
.progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    background: var(--color-accent);
    width: 0%;
    z-index: 1000;
    transition: width 0.1s ease;
}

/* Navigation */
.nav {
    position: sticky;
    top: 0;
    background: var(--color-background);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--color-border);
    z-index: 100;
    padding: var(--spacing-sm) 0;
}

.nav-content {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 var(--spacing-md);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-title {
    font-weight: 600;
    font-size: 15px;
    color: var(--color-navy);
}

.nav-cta {
    font-size: 14px;
    color: var(--color-accent);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.nav-cta:hover {
    color: var(--color-accent-hover);
}

.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    background: transparent;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    color: var(--color-text);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 16px;
}

.theme-toggle:hover {
    background: var(--color-background-alt);
    border-color: var(--color-text-light);
    transform: translateY(-1px);
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

/* Container */
.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: var(--spacing-xl) var(--spacing-md);
}

/* Hero */
.hero {
    margin-bottom: var(--spacing-xl);
    padding-bottom: var(--spacing-lg);
}

.hero h1 {
    font-size: 3.3rem;
    line-height: 1.15;
    color: var(--color-navy);
    margin-bottom: var(--spacing-md);
    font-weight: 700;
    letter-spacing: -0.02em;
}

.hero-subtitle {
    font-size: 1.75rem;
    color: var(--color-navy);
    font-weight: 500;
    line-height: 1.4;
    margin-top: var(--spacing-md);
}

.author-byline {
    font-size: 1rem;
    color: var(--color-text);
    font-weight: 400;
    font-style: italic;
    margin-top: var(--spacing-md);
    margin-bottom: 0;
}

/* Content */
.content section {
    margin-bottom: var(--spacing-lg);
    padding-bottom: var(--spacing-md);
    border-bottom: 1px solid var(--color-border);
}

.content section:last-of-type {
    border-bottom: none;
}

.content h2 {
    font-size: 1.875rem;
    line-height: 1.3;
    color: var(--color-navy);
    margin-bottom: var(--spacing-md);
    font-weight: 700;
    margin-top: 0;
    letter-spacing: -0.01em;
}

.content h3 {
    font-size: 1.25rem;
    line-height: 1.4;
    color: var(--color-navy);
    margin-bottom: var(--spacing-sm);
    margin-top: var(--spacing-lg);
    font-weight: 600;
}

.content p {
    margin-bottom: var(--spacing-md);
}

.content ul {
    margin-left: var(--spacing-md);
    margin-bottom: var(--spacing-md);
}

.content li {
    margin-bottom: var(--spacing-xs);
}

.content a {
    color: var(--color-accent);
    text-decoration: none;
    transition: color 0.2s ease;
}

.content a:hover {
    color: var(--color-accent-hover);
}

/* Blockquotes */
blockquote {
    margin: var(--spacing-xl) 0;
    padding: var(--spacing-lg) var(--spacing-xl);
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.03) 0%, rgba(59, 130, 246, 0.08) 100%);
    border-left: 4px solid var(--color-accent);
    border-radius: 8px;
    font-size: 1.25rem;
    font-style: italic;
    font-weight: 500;
    color: var(--color-navy);
    line-height: 1.7;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

[data-theme="dark"] blockquote {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.12) 0%, rgba(59, 130, 246, 0.18) 100%);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.pullquote {
    margin: var(--spacing-xl) 0;
    padding: var(--spacing-lg) 0;
    text-align: center;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--color-navy);
    border-top: 1px solid var(--color-border);
    border-bottom: 1px solid var(--color-border);
}

/* Signature Row */
.signature-row {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-xl);
}

/* Signature */
.signature {
    font-size: 1.125rem;
    color: var(--color-text);
    font-weight: 400;
    font-style: italic;
    margin: 0;
    align-self: flex-end;
}

/* Share and License Row */
.share-license-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--spacing-lg);
    width: 100%;
}

/* Share Section */
.share-section {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.share-label {
    font-size: 1.125rem;
    color: var(--color-navy);
    margin: 0;
    font-weight: 500;
}

/* Share Buttons */
.share-buttons {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.share-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    padding: 0;
    font-family: var(--font-sans);
    font-size: 24px;
    text-decoration: none;
    border-radius: 6px;
    border: none;
    outline: 1.5px solid var(--color-accent);
    outline-offset: -1.5px;
    background: var(--color-background);
    color: var(--color-text);
    transition: all 0.2s ease;
    cursor: pointer;
    position: relative;
}

.share-btn::after {
    content: attr(title);
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(8px);
    background: var(--color-text);
    color: var(--color-background);
    padding: 0.375rem 0.625rem;
    border-radius: 4px;
    font-size: 0.75rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    font-weight: 500;
    z-index: 1000;
}

.share-btn::before {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(2px);
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-bottom: 4px solid var(--color-text);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 1000;
}

.share-btn:hover::after {
    opacity: 1;
    transform: translateX(-50%) translateY(4px);
}

.share-btn:hover::before {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.share-btn:hover {
    background: var(--color-background-alt);
    border-color: var(--color-text-light);
    transform: translateY(-1px);
}

.share-btn i {
    font-size: 14px;
}

.share-btn.copied {
    background: #10b981;
    border-color: #10b981;
    color: white;
}

/* Article License */
.article-license {
    font-size: 14px;
    color: var(--color-text-light);
    text-align: right;
    margin: 0;
}

.article-license a {
    color: var(--color-accent);
    text-decoration: none;
    transition: color 0.2s ease;
}

.article-license a:hover {
    color: var(--color-accent-hover);
}

/* CTA Box */
.cta-box {
    margin: var(--spacing-lg) 0;
    padding: var(--spacing-lg);
    background: var(--color-background-alt);
    border-radius: 8px;
    border: 1px solid var(--color-border);
}

.cta-box h3 {
    margin-top: 0;
    margin-bottom: var(--spacing-md);
}

.cta-list {
    list-style: none;
    margin-left: 0;
    margin-bottom: var(--spacing-md);
}

.cta-list li {
    padding-left: var(--spacing-md);
    position: relative;
    margin-bottom: var(--spacing-sm);
}

.cta-list li:before {
    content: "→";
    position: absolute;
    left: 0;
    color: var(--color-accent);
    font-weight: 600;
}

.cta-buttons {
    display: flex;
    gap: var(--spacing-sm);
    flex-wrap: wrap;
}

.button {
    display: inline-block;
    padding: 12px 24px;
    font-family: var(--font-sans);
    font-size: 15px;
    font-weight: 500;
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.2s ease;
    text-align: center;
}

.button.primary {
    background: var(--color-accent);
    color: white;
    border: 1px solid var(--color-accent);
}

.button.primary:hover {
    background: var(--color-accent-hover);
    border-color: var(--color-accent-hover);
    transform: translateY(-1px);
}

.button.secondary {
    background: transparent;
    color: var(--color-accent);
    border: 1px solid var(--color-border);
}

.button.secondary:hover {
    border-color: var(--color-accent);
    background: var(--color-background-alt);
}

/* CTA Section */
.cta-section {
    margin: var(--spacing-xl) 0;
    padding: var(--spacing-xl) var(--spacing-lg);
    background: var(--color-background-alt);
    border-radius: 12px;
    border: 1px solid var(--color-border);
}

.cta-section h3 {
    font-size: 1.5rem;
    color: var(--color-navy);
    margin-bottom: var(--spacing-sm);
    margin-top: 0;
    text-align: center;
    font-weight: 700;
}

/* Star CTA */
.star-cta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-bottom: var(--spacing-lg);
    font-size: 14px;
    color: var(--color-text-light);
}

.star-text {
    font-weight: 400;
}

.star-button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--color-accent);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
}

.star-button:hover {
    color: var(--color-navy);
}

.star-button i {
    font-size: 14px;
    transition: transform 0.3s ease;
}

.star-button:hover i {
    transform: rotate(72deg);
}

.cta-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
}

.cta-card {
    padding: var(--spacing-lg) var(--spacing-xl);
    background: var(--color-background);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    transition: all 0.2s ease;
}

.cta-card:hover {
    border-color: var(--color-accent);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.1);
}

.cta-card h4 {
    font-size: 1.125rem;
    color: var(--color-navy);
    margin-bottom: var(--spacing-sm);
    margin-top: 0;
    font-weight: 600;
}

.cta-card p {
    font-size: 15px;
    color: var(--color-text);
    margin-bottom: var(--spacing-md);
    line-height: 1.6;
}

.cta-links {
    display: flex;
    gap: var(--spacing-sm);
    align-items: center;
}

.cta-icon-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: var(--color-background-alt);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    color: var(--color-text);
    text-decoration: none;
    font-size: 20px;
    transition: all 0.2s ease;
}

.cta-icon-link:hover {
    background: var(--color-accent);
    border-color: var(--color-accent);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.cta-link {
    display: inline-flex;
    align-items: center;
    color: var(--color-accent);
    text-decoration: none;
    font-weight: 500;
    font-size: 15px;
    transition: all 0.2s ease;
    border-bottom: 1px solid transparent;
}

.cta-link:hover {
    color: var(--color-accent-hover);
    border-bottom-color: var(--color-accent-hover);
}

.contact-row {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    margin-top: var(--spacing-xs);
}

.cta-link-text {
    color: var(--color-accent);
    font-weight: 500;
    font-size: 15px;
}

.social-links {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.social-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: var(--color-background-alt);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    color: var(--color-text);
    text-decoration: none;
    font-size: 20px;
    transition: all 0.2s ease;
}

.social-icon:hover {
    background: var(--color-accent);
    border-color: var(--color-accent);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.cta-footer {
    margin-top: var(--spacing-lg);
    padding-top: var(--spacing-lg);
    border-top: 1px solid var(--color-border);
}

.cta-note {
    text-align: center;
    font-size: 15px;
    color: var(--color-text);
    line-height: 1.7;
    margin: 0;
}

.cta-note strong {
    color: var(--color-navy);
    font-weight: 600;
}

/* Equation */
.equation {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: var(--spacing-xs);
    font-size: 1.125rem;
    line-height: 1.5;
}

.equation-part {
    color: var(--color-navy);
    font-weight: 600;
    padding: 8px 16px;
    background: var(--color-background);
    border-radius: 6px;
    border: 1px solid var(--color-border);
    transition: all 0.2s ease;
}

.equation-operator,
.equation-equals {
    color: var(--color-text-light);
    font-weight: 400;
    font-size: 1.25rem;
}

.equation-equals {
    font-weight: 600;
    color: var(--color-accent);
    margin: 0 var(--spacing-sm);
}

.equation-result {
    color: var(--color-navy);
    font-weight: 700;
    padding: 8px 20px;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.05) 0%, rgba(59, 130, 246, 0.1) 100%);
    border-radius: 6px;
    border: 1px solid var(--color-accent);
}

/* FAQ */
.faq {
    margin-top: var(--spacing-xl);
    padding-top: 0;
    border-top: none;
}

.faq-item {
    margin-bottom: var(--spacing-lg);
}

.faq-item h3 {
    font-size: 1.125rem;
    margin-bottom: var(--spacing-sm);
    margin-top: 0;
    color: var(--color-navy);
}

.faq-item p {
    color: var(--color-text);
    margin-bottom: 0;
}

/* Footer */
.footer {
    margin-top: var(--spacing-xl);
    padding: var(--spacing-xl) 0;
    border-top: 1px solid var(--color-border);
    background: var(--color-background);
}

.footer-content {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 var(--spacing-md);
}

.footer-links {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
}

.footer-link-card {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-md);
    background: var(--color-background);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.2s ease;
    color: var(--color-navy);
    font-size: 15px;
    font-weight: 500;
}

.footer-link-card:hover {
    border-color: var(--color-accent);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] .footer-link-card {
    background: var(--color-background-alt);
}

[data-theme="dark"] .footer-link-card:hover {
    box-shadow: 0 2px 12px rgba(96, 165, 250, 0.2);
}

.footer-icon {
    width: 24px;
    height: 24px;
    color: var(--color-accent);
    flex-shrink: 0;
}

.footer-note {
    font-size: 14px;
    color: var(--color-text-light);
    text-align: center;
    margin-top: var(--spacing-lg);
    padding-top: var(--spacing-lg);
    border-top: 1px solid var(--color-border);
}

.footer-note a {
    color: var(--color-accent);
    text-decoration: none;
    transition: color 0.2s ease;
}

.footer-note a:hover {
    color: var(--color-accent-hover);
}

/* Mobile line break control */
.mobile-break {
    display: none;
}

/* Responsive */
@media (max-width: 768px) {
    .mobile-break {
        display: inline;
    }

    body {
        font-size: 17px;
    }

    .hero h1 {
        font-size: 2rem;
    }

    .hero-subtitle {
        font-size: 1.4rem;
    }

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

    .content h3 {
        font-size: 1.125rem;
    }

    .pullquote {
        font-size: 1.25rem;
    }

    blockquote {
        font-size: 1.125rem;
        padding: var(--spacing-md) var(--spacing-lg);
    }

    .container {
        padding: var(--spacing-lg) var(--spacing-sm);
    }

    .cta-buttons {
        flex-direction: column;
    }

    .button {
        width: 100%;
    }

    .nav-content {
        padding: 0 var(--spacing-sm);
    }

    .signature-row {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--spacing-sm);
    }

    .signature {
        width: 100%;
    }

    .share-license-row {
        flex-direction: column;
        gap: var(--spacing-md);
    }

    .article-license {
        text-align: left;
        padding-top: var(--spacing-md);
        border-top: 1px solid var(--color-border);
    }

    .share-buttons {
        width: 100%;
    }

    .cta-section {
        padding: var(--spacing-lg) var(--spacing-md);
    }

    .cta-section h3 {
        font-size: 1.25rem;
    }

    .cta-grid {
        gap: var(--spacing-md);
    }

    .star-cta {
        flex-wrap: wrap;
        font-size: 13px;
    }

    .cta-card {
        padding: var(--spacing-lg) var(--spacing-md);
    }

    .equation {
        gap: 6px;
        font-size: 1rem;
    }

    .equation-part,
    .equation-result {
        padding: 6px 12px;
        font-size: 0.95rem;
    }

    .equation-operator,
    .equation-equals {
        font-size: 1.125rem;
    }

    .equation-equals {
        margin: 0 10px;
    }
}

@media (max-width: 480px) {
    .hero h1 {
        font-size: 1.75rem;
    }

    .hero-subtitle {
        font-size: 1.25rem;
    }

    .footer-links {
        grid-template-columns: 1fr;
        gap: var(--spacing-sm);
    }
}