/**
 * WordPress Block Editor Styles
 *
 * @package Yicheng_Commonweal
 */

/* ====================================
   Entry Content - Base Styles
   ==================================== */

.entry-content {
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* ====================================
   Typography & Text Formatting
   ==================================== */

/* Headings */
.entry-content h1,
.entry-content h2,
.entry-content h3,
.entry-content h4,
.entry-content h5,
.entry-content h6 {
    font-weight: 700;
    line-height: 1.4;
    margin-top: 2rem;
    margin-bottom: 1rem;
    color: inherit;
}

.entry-content h1 { font-size: 2.5rem; }
.entry-content h2 { font-size: 2rem; }
.entry-content h3 { font-size: 1.75rem; }
.entry-content h4 { font-size: 1.5rem; }
.entry-content h5 { font-size: 1.25rem; }
.entry-content h6 { font-size: 1rem; }

/* Paragraphs */
.entry-content p {
    margin-bottom: 1.5rem;
    line-height: 1.8;
}

/* Strong and Bold */
.entry-content strong,
.entry-content b {
    font-weight: 700;
}

/* Emphasis and Italic */
.entry-content em,
.entry-content i {
    font-style: italic;
}

/* Links */
.entry-content a {
    color: #CA7E4B; /* Accent color */
    text-decoration: none;
    transition: all 0.3s ease;
}

.entry-content a:hover {
    text-decoration: underline;
    color: #B36D3F; /* Slightly darker on hover */
}

.entry-content a:visited {
    color: #A86542;
}

/* ====================================
   Block Editor Specific Classes
   ==================================== */

/* WordPress Block Base */
.wp-block {
    max-width: 100%;
}

/* Text Alignment */
.has-text-align-left {
    text-align: left;
}

.has-text-align-center {
    text-align: center;
}

.has-text-align-right {
    text-align: right;
}

.has-text-align-justify {
    text-align: justify;
}

/* ====================================
   Lists
   ==================================== */

.entry-content ul,
.entry-content ol {
    margin-bottom: 1.5rem;
    padding-left: 2rem;
}

.entry-content ul {
    list-style-type: disc;
}

.entry-content ol {
    list-style-type: decimal;
}

.entry-content li {
    margin-bottom: 0.5rem;
    line-height: 1.8;
}

.entry-content ul ul,
.entry-content ol ol,
.entry-content ul ol,
.entry-content ol ul {
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
}

/* Block List */
.wp-block-list {
    margin-bottom: 1.5rem;
    padding-left: 2rem;
}

.wp-block-list li {
    margin-bottom: 0.5rem;
}

/* ====================================
   Quotes and Blockquotes
   ==================================== */

.entry-content blockquote,
.wp-block-quote {
    margin: 2rem 0;
    padding-left: 1.5rem;
    border-left: 4px solid #e5e7eb;
    font-style: italic;
    color: #6b7280;
}

.wp-block-quote cite {
    display: block;
    margin-top: 1rem;
    font-style: normal;
    font-size: 0.875rem;
    color: #9ca3af;
}

/* ====================================
   Code Blocks
   ==================================== */

.entry-content code {
    padding: 0.125rem 0.375rem;
    background-color: #f3f4f6;
    border-radius: 0.25rem;
    font-size: 0.875em;
    font-family: monospace;
}

.entry-content pre {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background-color: #1f2937;
    color: #f9fafb;
    border-radius: 0.5rem;
    overflow-x: auto;
}

.entry-content pre code {
    padding: 0;
    background-color: transparent;
    color: inherit;
}

/* ====================================
   Images and Media
   ==================================== */

.entry-content img {
    max-width: 100%;
    height: auto;
    display: block;
}

.wp-block-image {
    margin-bottom: 1.5rem;
}

.wp-block-image img {
    max-width: 100%;
    height: auto;
}

.wp-block-image figcaption {
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: #6b7280;
    text-align: center;
}

/* Image Alignment */
.wp-block-image.alignleft,
.alignleft {
    float: left;
    margin-right: 1.5rem;
    margin-bottom: 1rem;
}

.wp-block-image.alignright,
.alignright {
    float: right;
    margin-left: 1.5rem;
    margin-bottom: 1rem;
}

.wp-block-image.aligncenter,
.aligncenter {
    margin-left: auto;
    margin-right: auto;
}

/* ====================================
   Buttons
   ==================================== */

.wp-block-button {
    margin-bottom: 1.5rem;
}

.wp-block-button__link {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background-color: #3b82f6;
    color: #ffffff;
    text-decoration: none;
    border-radius: 0.375rem;
    font-weight: 500;
    transition: background-color 0.2s;
}

.wp-block-button__link:hover {
    background-color: #2563eb;
}

/* ====================================
   Separators
   ==================================== */

.entry-content hr,
.wp-block-separator {
    margin: 2rem 0;
    border: 0;
    border-top: 1px solid #e5e7eb;
}

/* ====================================
   Tables
   ==================================== */

.entry-content table,
.wp-block-table {
    width: 100%;
    margin-bottom: 1.5rem;
    border-collapse: collapse;
}

.entry-content table th,
.entry-content table td,
.wp-block-table th,
.wp-block-table td {
    padding: 0.75rem;
    border: 1px solid #e5e7eb;
    text-align: left;
}

.entry-content table th,
.wp-block-table th {
    background-color: #f9fafb;
    font-weight: 600;
}

/* ====================================
   Columns and Layout
   ==================================== */

.wp-block-columns {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    margin-bottom: 1.5rem;
}

.wp-block-column {
    flex: 1;
    min-width: 0;
}

@media (max-width: 768px) {
    .wp-block-columns {
        flex-direction: column;
    }
}

/* ====================================
   Group and Cover Blocks
   ==================================== */

.wp-block-group {
    margin-bottom: 1.5rem;
}

.wp-block-cover {
    position: relative;
    min-height: 400px;
    padding: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background-size: cover;
    background-position: center;
    margin-bottom: 1.5rem;
}

/* ====================================
   Embed Blocks (YouTube, etc.)
   ==================================== */

.wp-block-embed {
    margin-bottom: 1.5rem;
}

.wp-block-embed__wrapper {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    height: 0;
    overflow: hidden;
}

.wp-block-embed__wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* ====================================
   Pullquote
   ==================================== */

.wp-block-pullquote {
    margin: 2rem 0;
    padding: 2rem;
    border-top: 4px solid #e5e7eb;
    border-bottom: 4px solid #e5e7eb;
    text-align: center;
}

.wp-block-pullquote blockquote {
    margin: 0;
    padding: 0;
    border: 0;
    font-size: 1.5rem;
    font-style: italic;
}

.wp-block-pullquote cite {
    display: block;
    margin-top: 1rem;
    font-style: normal;
    font-size: 1rem;
    color: #6b7280;
}

/* ====================================
   Spacing Utilities
   ==================================== */

.wp-block-spacer {
    clear: both;
}

/* ====================================
   Verse Block
   ==================================== */

.wp-block-verse {
    font-family: inherit;
    white-space: pre-wrap;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background-color: #f9fafb;
    border-radius: 0.375rem;
}

/* ====================================
   File Block
   ==================================== */

.wp-block-file {
    margin-bottom: 1.5rem;
}

.wp-block-file a {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 1rem;
    background-color: #f3f4f6;
    border-radius: 0.375rem;
    text-decoration: none;
    transition: background-color 0.2s;
}

.wp-block-file a:hover {
    background-color: #e5e7eb;
}

/* ====================================
   Gallery Block
   ==================================== */

.wp-block-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.wp-block-gallery .wp-block-image {
    margin: 0;
}

/* ====================================
   Audio and Video Blocks
   ==================================== */

.wp-block-audio,
.wp-block-video {
    margin-bottom: 1.5rem;
}

.wp-block-audio audio,
.wp-block-video video {
    width: 100%;
    max-width: 100%;
}

/* ====================================
   Calendar Block
   ==================================== */

.wp-block-calendar {
    margin-bottom: 1.5rem;
}

.wp-block-calendar table {
    width: 100%;
}

.wp-block-calendar th,
.wp-block-calendar td {
    padding: 0.5rem;
    text-align: center;
    border: 1px solid #e5e7eb;
}

/* ====================================
   Latest Posts Block
   ==================================== */

.wp-block-latest-posts {
    margin-bottom: 1.5rem;
    padding-left: 0;
    list-style: none;
}

.wp-block-latest-posts li {
    margin-bottom: 1rem;
}

.wp-block-latest-posts__post-title {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.wp-block-latest-posts__post-date {
    font-size: 0.875rem;
    color: #6b7280;
}

/* ====================================
   Archive and Categories Blocks
   ==================================== */

.wp-block-archives,
.wp-block-categories {
    margin-bottom: 1.5rem;
    padding-left: 0;
    list-style: none;
}

.wp-block-archives li,
.wp-block-categories li {
    margin-bottom: 0.5rem;
}

/* ====================================
   Search Block
   ==================================== */

.wp-block-search {
    margin-bottom: 1.5rem;
}

.wp-block-search__input {
    padding: 0.5rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.375rem;
    width: 100%;
}

.wp-block-search__button {
    padding: 0.5rem 1rem;
    background-color: #3b82f6;
    color: #ffffff;
    border: 0;
    border-radius: 0.375rem;
    cursor: pointer;
    margin-left: 0.5rem;
}

/* ====================================
   Social Links Block
   ==================================== */

.wp-block-social-links {
    display: flex;
    gap: 1rem;
    padding-left: 0;
    list-style: none;
    margin-bottom: 1.5rem;
}

.wp-block-social-link {
    display: inline-block;
}

.wp-block-social-link a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    background-color: #3b82f6;
    color: #ffffff;
    border-radius: 50%;
    text-decoration: none;
    transition: background-color 0.2s;
}

.wp-block-social-link a:hover {
    background-color: #2563eb;
}

/* ====================================
   Tag Cloud Block
   ==================================== */

.wp-block-tag-cloud {
    margin-bottom: 1.5rem;
}

.wp-block-tag-cloud a {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    margin: 0.25rem;
    background-color: #f3f4f6;
    border-radius: 0.375rem;
    text-decoration: none;
    font-size: 0.875rem;
    transition: background-color 0.2s;
}

.wp-block-tag-cloud a:hover {
    background-color: #e5e7eb;
}

/* ====================================
   Preformatted Block
   ==================================== */

.wp-block-preformatted {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background-color: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 0.375rem;
    overflow-x: auto;
    white-space: pre-wrap;
    font-family: monospace;
}

/* ====================================
   More Block
   ==================================== */

.entry-content .more-link {
    display: inline-block;
    margin-top: 1rem;
    padding: 0.5rem 1rem;
    background-color: #3b82f6;
    color: #ffffff;
    text-decoration: none;
    border-radius: 0.375rem;
    transition: background-color 0.2s;
}

.entry-content .more-link:hover {
    background-color: #2563eb;
}

/* ====================================
   Clearfix for Floats
   ==================================== */

.entry-content::after {
    content: "";
    display: table;
    clear: both;
}

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

@media (max-width: 768px) {
    .entry-content h1 { font-size: 2rem; }
    .entry-content h2 { font-size: 1.75rem; }
    .entry-content h3 { font-size: 1.5rem; }
    .entry-content h4 { font-size: 1.25rem; }
    .entry-content h5 { font-size: 1.125rem; }
    .entry-content h6 { font-size: 1rem; }

    .alignleft,
    .alignright {
        float: none;
        margin: 0 0 1rem 0;
    }
}

/* ====================================
   Fix for Imported Content Issues
   ==================================== */

/* Remove excessive spacing */
.entry-content > *:first-child {
    margin-top: 0;
}

.entry-content > *:last-child {
    margin-bottom: 0;
}

/* Fix for nested alignment classes */
.entry-content [style*="vertical-align"] {
    vertical-align: inherit;
}

/* Fix for inline styles that might break layout */
.entry-content span[dir],
.entry-content span[style*="vertical-align"] {
    display: inline;
}

/* Ensure proper line breaking */
.entry-content * {
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Fix for font weight issues */
.entry-content .has-text-align-left,
.entry-content .has-text-align-center,
.entry-content .has-text-align-right {
    font-weight: inherit;
}
