/* Chapter Content Markdown Formatting */
.chapter-content {
    width: 100%;
    line-height: 1.6;
    color: var(--text-secondary);
}

.chapter-header {
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-primary);
}

.chapter-header .chapter-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
    line-height: 1.2;
}

.chapter-header .chapter-subtitle {
    font-size: 1.1rem;
    color: var(--text-tertiary);
    font-style: italic;
    margin: 0;
}

.chapter-body {
    width: 100%;
    font-size: 1rem;
    line-height: 1.6;
}

.chapter-intro {
    font-size: 1.2rem;
    line-height: 1.4;
    color: var(--text-primary);
    margin-bottom: 30px;
    padding: 20px 25px;
    background: var(--bg-secondary);
    border: 1px solid var(--text-primary);
    font-style: normal;
    font-weight: 600;
    letter-spacing: -0.01em;
    text-align: left;
}

/* Standard Markdown Elements */
.chapter-content a {
    color: var(--link-color);
    text-decoration: none;
    border-bottom: none;
}

.chapter-content h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 20px 0;
    line-height: 1.2;
}

.chapter-content h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 30px 0 15px 0;
    line-height: 1.3;
}

.chapter-content h3 {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 25px 0 12px 0;
    line-height: 1.3;
}

.chapter-content h4 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 20px 0 10px 0;
    line-height: 1.3;
}

.chapter-content p {
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.chapter-content ul, .chapter-content ol {
    margin: 16px 0;
    padding-left: 24px;
}

.chapter-content li {
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.chapter-content blockquote {
    margin: 20px 0;
    padding: 16px 20px;
    background: var(--blockquote-bg);
    border-left: 3px solid var(--blockquote-border);
    font-style: italic;
    color: var(--blockquote-text);
}

.chapter-content code {
    background: var(--code-bg);
    padding: 2px 4px;
    border-radius: 3px;
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 0.9rem;
    color: var(--code-text);
    border: 1px solid var(--code-border);
}

.chapter-content pre {
    background: var(--code-bg);
    padding: 16px;
    border-radius: 3px;
    overflow-x: auto;
    margin: 16px 0;
    border: 1px solid var(--code-border);
}

.chapter-content pre code {
    background: none;
    padding: 0;
}

.chapter-content strong {
    font-weight: 600;
    color: var(--text-primary);
}

.chapter-content em {
    font-style: italic;
}

.chapter-content hr {
    border: none;
    border-top: 1px solid var(--border-primary);
    margin: 30px 0;
}

.chapter-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
}

.chapter-content th,
.chapter-content td {
    padding: 8px 12px;
    text-align: left;
    border-bottom: 1px solid var(--table-border);
}

.chapter-content th {
    font-weight: 600;
    background: var(--table-header-bg);
}

/* Guiding Principles Specific Styling */
.principle-section {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: 1px solid var(--border-secondary);
}

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

.principle-title {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.principle-section p {
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

/* Checklist Styling */
.checklist {
    margin: 20px 0;
    padding-left: 20px;
}

.checklist-item {
    display: flex;
    align-items: center;
    margin-bottom: 6px;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1.5;
    color: var(--text-secondary);
    padding: 4px 0;
    transition: background-color 0.1s ease;
}

.checklist-item:hover {
    background-color: var(--bg-tertiary);
    padding-left: 8px;
    padding-right: 8px;
    border-radius: 4px;
    margin-left: -8px;
    margin-right: -8px;
}

.checklist-checkbox {
    margin-right: 10px;
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    accent-color: var(--checkbox-accent);
    cursor: pointer;
    border: 1px solid var(--checkbox-border);
    border-radius: 2px;
    background-color: var(--checkbox-bg);
}

.checklist-text {
    flex: 1;
    cursor: pointer;
}

.checklist-item:has(.checklist-checkbox:checked) .checklist-text {
    text-decoration: line-through;
    color: var(--checkbox-checked-text);
}

/* Red flags checklist variation */
.red-flags .checklist-item {
    border-left: 3px solid var(--red-flag-border);
    padding-left: 12px;
    margin-left: 0;
}

.red-flags .checklist-item:hover {
    background-color: var(--red-flag-hover-bg);
    border-left-color: var(--red-flag-hover-border);
}

.closing-note {
    margin-top: 40px;
    padding: 25px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-secondary);
}

.closing-note p {
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-muted);
    margin: 0;
    font-style: italic;
}

/* Title Page Styling */
.title-page {
    text-align: center;
    padding: 60px 40px 40px 40px;
    margin: 30px auto;
    height: auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 12px;
    overflow: visible;
}

.title-section {
    margin-bottom: 0;
}

.main-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 16px 0;
    line-height: 1.1;
    letter-spacing: -0.02em;
}

.subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin: 0 0 12px 0;
    font-weight: 400;
    line-height: 1.4;
}

.tagline {
    font-size: 1rem;
    color: var(--text-tertiary);
    margin: 0;
    font-style: italic;
    line-height: 1.4;
}

.last-updated {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin: 8px 0 0 0;
    font-style: italic;
    line-height: 1.3;
}

.author-section {
    border-top: 1px solid var(--border-secondary);
    border-bottom: 1px solid var(--border-secondary);
    padding: 15px 0;
    margin: 0;
}

.author-byline {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 8px 0;
}

.author-expertise {
    font-size: 1rem;
    color: var(--text-secondary);
    margin: 0 0 6px 0;
    line-height: 1.4;
}

.author-note {
    font-size: 1rem;
    color: var(--text-tertiary);
    margin: 0;
    font-style: italic;
}

.target-audience-section {
    margin: 0;
}

.section-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 8px 0;
    line-height: 1.2;
}

.audience-description {
    font-size: 1rem;
    color: var(--text-secondary);
    margin: 0;
    font-weight: 400;
    line-height: 1.4;
}

/* Dark Mode Styles - All colors are now inherited from theme variables */
/* No specific dark mode overrides needed since we use CSS custom properties */

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .chapter-header .chapter-title {
        font-size: 1.7rem;
        margin-bottom: 12px;
        line-height: 1.3;
    }

    .chapter-header .chapter-subtitle {
        font-size: 1rem;
        margin-bottom: 0;
    }

    .chapter-content h1 {
        font-size: 1.7rem;
        margin: 0 0 16px 0;
    }

    .chapter-content h2 {
        font-size: 1.4rem;
        margin: 28px 0 14px 0;
    }

    .chapter-content h3 {
        font-size: 1.2rem;
        margin: 24px 0 12px 0;
    }

    .chapter-content h4 {
        font-size: 1.1rem;
        margin: 20px 0 10px 0;
    }

    .chapter-content p {
        font-size: 1rem;
        line-height: 1.7;
        margin-bottom: 18px;
    }

    .chapter-intro {
        padding: 18px 20px;
        margin-bottom: 24px;
        font-size: 1.1rem;
        line-height: 1.4;
        border: 1px solid var(--text-primary);
    }


    .principle-title {
        font-size: 1.2rem;
        margin-bottom: 10px;
    }

    .principle-section {
        margin-bottom: 24px;
        padding-bottom: 16px;
    }

    /* Enhanced Title Page Mobile Styles */
    .title-page {
        padding: 20px 16px;
        gap: 24px;
        height: auto;
        min-height: 100vh;
        max-height: none;
        justify-content: flex-start;
        padding-top: 60px;
    }

    .title-section {
        margin-bottom: 0;
        padding-bottom: 0;
    }

    .main-title {
        font-size: 2.8rem;
        margin-bottom: 16px;
        line-height: 1.1;
        letter-spacing: -0.01em;
    }

    .subtitle {
        font-size: 1.4rem;
        margin-bottom: 10px;
        line-height: 1.4;
        color: var(--text-secondary);
    }

    .tagline {
        font-size: 1.1rem;
        line-height: 1.5;
        margin-bottom: 4px;
        color: var(--text-tertiary);
    }

    .author-section {
        padding: 20px 0;
        margin: 16px 0;
        border-top: 1px solid #ddd;
        border-bottom: 1px solid #ddd;
    }

    .author-byline {
        font-size: 1.3rem;
        margin-bottom: 10px;
        font-weight: 600;
    }

    .author-expertise {
        font-size: 1rem;
        line-height: 1.5;
        margin-bottom: 6px;
        color: var(--text-secondary);
    }

    .author-note {
        font-size: 0.95rem;
        line-height: 1.4;
        color: var(--text-tertiary);
        margin-bottom: 2px;
    }

    .target-audience-section {
        margin: 0;
        padding: 0;
    }

    .section-title {
        font-size: 1.4rem;
        margin-bottom: 12px;
        line-height: 1.3;
    }

    .audience-description {
        font-size: 1.1rem;
        line-height: 1.4;
        font-weight: 500;
        color: var(--text-secondary);
        margin-bottom: 0;
    }
}

/* Extra small mobile devices */
@media (max-width: 480px) {
    .title-page {
        padding: 16px 12px;
        padding-top: 50px;
        gap: 20px;
    }

    .main-title {
        font-size: 2.4rem;
        margin-bottom: 14px;
    }

    .subtitle {
        font-size: 1.2rem;
        margin-bottom: 8px;
    }

    .tagline {
        font-size: 1rem;
        margin-bottom: 3px;
    }

    .author-section {
        padding: 16px 0;
        margin: 12px 0;
    }

    .author-byline {
        font-size: 1.2rem;
        margin-bottom: 8px;
    }

    .author-expertise {
        font-size: 0.95rem;
        margin-bottom: 5px;
    }

    .author-note {
        font-size: 0.9rem;
        margin-bottom: 2px;
    }

    .section-title {
        font-size: 1.3rem;
        margin-bottom: 10px;
    }

    .audience-description {
        font-size: 1rem;
        margin-bottom: 0;
    }

    .chapter-content p {
        font-size: 0.95rem;
        line-height: 1.7;
    }

    .chapter-intro {
        padding: 16px 18px;
        font-size: 1.1rem;
        border: 1px solid black;
    }

}

/* Button styles using theme variables */
button {
    background: var(--button-bg) !important;
    color: var(--button-text) !important;
    border: 1px solid var(--button-bg) !important;
    transition: all 0.2s ease;
}

button:hover {
    background: var(--button-hover-bg) !important;
    color: var(--button-hover-text) !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
}

/* Text below buttons */
div[style*="color: #444"] {
    color: var(--text-secondary) !important;
}

/* Next chapter button container */
div[style*="text-align: center"] {
    margin-top: 0;
}

/* Email Signup Section Styles */
.email-signup-section {
    margin: 40px 0;
    padding: 25px;
    background: var(--bg-secondary);
    border: 1px solid var(--text-primary);
    text-align: center;
    border-radius: 0;
}

/* Title page specific email signup styling */
.title-page .email-signup-section {
    margin: 20px 0 0 0;
    padding: 20px 20px 0 20px;
    border: none;
    background: transparent;
}

.title-page .email-signup-title {
    font-size: 1.1rem;
    margin: 0 0 16px 0;
}

.title-page .email-input-container {
    margin-bottom: 0;
}

.email-signup-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 20px 0;
    line-height: 1.3;
    letter-spacing: -0.01em;
}

.email-signup-form {
    margin: 0;
}

.email-input-container {
    display: flex;
    gap: 0;
    max-width: 600px;
    margin: 0 auto;
    border: none;
    border-radius: 0;
    overflow: hidden;
}

.email-input {
    flex: 1;
    padding: 14px 20px;
    border: none;
    font-size: 1rem;
    background: var(--input-bg) !important;
    color: var(--input-text);
    outline: none;
    font-weight: 500;
    box-shadow: none !important;
    -webkit-box-shadow: none !important;
}

/* Override browser autofill styling */
.email-input:-webkit-autofill,
.email-input:-webkit-autofill:hover,
.email-input:-webkit-autofill:focus,
.email-input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 30px var(--input-bg) inset !important;
    box-shadow: 0 0 0 30px var(--input-bg) inset !important;
    background-color: var(--input-bg) !important;
    background: var(--input-bg) !important;
    -webkit-text-fill-color: var(--input-text) !important;
}

.email-input::placeholder {
    color: var(--input-placeholder);
}

.email-submit-btn {
    padding: 12px 20px;
    background: var(--button-bg);
    color: var(--button-text);
    border: none;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.email-submit-btn:hover {
    background: var(--button-hover-bg);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
}

/* Q&A Page Specific Styles */
.quick-answer {
    margin-bottom: 12px;
    padding: 8px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
}

.quick-answer h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 30px 0 15px 0;
    line-height: 1.3;
}

.quick-answer .yellow-highlight {
    background: transparent !important;
    color: var(--text-primary) !important;
}

.quick-answer p {
    margin-bottom: 0;
}

.detailed-answer {
    margin-bottom: 40px;
}

.detailed-answer h2 {
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 30px 0 20px 0;
    border-bottom: 2px solid var(--text-primary);
    padding-bottom: 8px;
}

.related-questions {
    margin-top: 0;
    padding: 25px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-secondary);
}

.related-questions h2 {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 20px 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.related-qa {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-secondary);
}

.related-qa:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.related-qa h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 8px 0;
    line-height: 1.3;
}

.related-qa p {
    font-size: 0.95rem;
    line-height: 1.5;
    color: var(--text-secondary);
    margin: 0;
}

/* Mobile Responsiveness for Q&A */
@media (max-width: 768px) {
    .quick-answer {
        padding: 18px 20px;
        margin-bottom: 24px;
    }

    .quick-answer h2 {
        font-size: 1.1rem;
        margin-bottom: 10px;
    }


    .detailed-answer h2 {
        font-size: 1.3rem;
        margin: 24px 0 16px 0;
        padding-bottom: 6px;
    }

    .related-questions {
        padding: 20px 16px;
        margin-top: 32px;
    }

    .related-questions h2 {
        font-size: 1.2rem;
        margin-bottom: 16px;
    }

    .related-qa {
        margin-bottom: 16px;
        padding-bottom: 12px;
    }

    .related-qa h3 {
        font-size: 1rem;
        margin-bottom: 6px;
    }

    .related-qa p {
        font-size: 0.9rem;
        line-height: 1.6;
    }
}

/* Email signup styles now use theme variables - no dark mode overrides needed */

/* Mobile Responsiveness for Email Signup */
@media (max-width: 768px) {
    .email-signup-section {
        margin: 32px 0;
        padding: 24px 20px;
    }

    .email-signup-title {
        font-size: 1.1rem;
        margin-bottom: 16px;
    }

    .email-input-container {
        flex-direction: column;
        max-width: none;
        border: none;
        border-radius: 0;
        overflow: visible;
        gap: 8px;
    }

    .email-input {
        border: 1px solid var(--text-primary);
        border-radius: 0;
        padding: 14px 16px;
        font-size: 1rem;
    }

    .email-submit-btn {
        border-radius: 0;
        padding: 14px 20px;
        font-size: 1rem;
    }

}

@media (max-width: 480px) {
    .email-signup-section {
        margin: 28px 0;
        padding: 20px 16px;
    }

    .email-signup-title {
        font-size: 1rem;
        margin-bottom: 14px;
    }
}
