/**
 * Dream Spa — Migrated Blog Content Styles (v2)
 *
 * Styles for blog post body content migrated from the old Dream Spa site.
 * Targets .ds-blog-content wrapper applied by single.php.
 *
 * Key features:
 *  - Generous paragraph and section spacing
 *  - Properly indented bullet/numbered lists with gold markers
 *  - Magazine-style alternating image floats (text wraps around images)
 *  - Headings clear floats so each new section starts cleanly
 *  - Full mobile stack (no floats on small screens)
 *
 * Load via: wp_enqueue_style('ds-blog-content', ...) on is_single().
 */

/* ─── Base Content Wrapper ────────────────────────────── */
.ds-blog-content {
    color: var(--ds-text);
    font-size: 16.5px;
    line-height: 1.9;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* ─── Paragraphs ──────────────────────────────────────── */
.ds-blog-content p {
    margin-top: 0;
    margin-bottom: 1.6em;
}

.ds-blog-content p:last-child {
    margin-bottom: 0;
}

/* ─── Headings ────────────────────────────────────────── */
.ds-blog-content h2,
.ds-blog-content h3,
.ds-blog-content h4,
.ds-blog-content h5 {
    font-family: var(--ds-font-serif);
    color: var(--ds-cream);
    margin-top: 2.5em;
    margin-bottom: 0.85em;
    letter-spacing: 0.04em;
    clear: both; /* always start each heading on a clean line past any floated image */
}

/* First element in the content — no extra top margin */
.ds-blog-content > *:first-child {
    margin-top: 0;
}

.ds-blog-content h2 {
    font-size: 28px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--ds-border);
}

.ds-blog-content h3 {
    font-size: 22px;
}

.ds-blog-content h4 {
    font-size: 18px;
    color: var(--ds-gold);
}

.ds-blog-content h5 {
    font-size: 16px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--ds-text-muted);
}

/* ─── Links ───────────────────────────────────────────── */
.ds-blog-content a {
    color: var(--ds-gold);
    text-decoration: underline;
    text-underline-offset: 3px;
    transition: color var(--ds-transition);
}

.ds-blog-content a:hover {
    color: var(--ds-gold-light);
}

/* ─── Lists ───────────────────────────────────────────── */
.ds-blog-content ul,
.ds-blog-content ol {
    margin: 0.4em 0 1.75em 0;
    padding-left: 2.4em;
    list-style-position: outside;
}

.ds-blog-content ul {
    list-style-type: disc;
}

.ds-blog-content ol {
    list-style-type: decimal;
}

.ds-blog-content li {
    margin-bottom: 0.7em;
    line-height: 1.8;
    padding-left: 0.3em;
}

.ds-blog-content li:last-child {
    margin-bottom: 0;
}

.ds-blog-content ul > li::marker {
    color: var(--ds-gold);
    font-size: 1.05em;
}

.ds-blog-content ol > li::marker {
    color: var(--ds-gold);
    font-weight: 600;
}

.ds-blog-content li > ul,
.ds-blog-content li > ol {
    margin-top: 0.5em;
    margin-bottom: 0.4em;
}

/* ─── Magazine-Style Image Layout ────────────────────────
 *
 * Images float alternately left and right so body text
 * flows around them like a magazine or editorial layout.
 *
 * - <figure> / .wp-block-image  → odd = float right, even = float left
 * - <p> containing only an <img> → floats right by default
 * - Explicit .alignleft / .alignright honour the author's choice
 * - .alignfull / .aligncenter stay full-width (no float)
 * - Headings have clear:both so sections never start mid-float
 * - On mobile (≤ 768 px) all floats are removed
 * ─────────────────────────────────────────────────────── */

/* Figures (WordPress image blocks) */
.ds-blog-content figure,
.ds-blog-content .wp-block-image {
    float: right;
    max-width: 46%;
    margin: 0.4em 0 2.2em 2.8em;
    clear: none;
    shape-outside: border-box;
}

.ds-blog-content figure:nth-of-type(2n),
.ds-blog-content .wp-block-image:nth-of-type(2n) {
    float: left;
    margin: 0.4em 2.8em 2.2em 0;
}

/* Image inside a paragraph (plain <img> in post content) */
.ds-blog-content p > img {
    float: right;
    max-width: 46%;
    margin: 0.4em 0 2em 2.8em;
    border-radius: var(--ds-radius-lg);
    height: auto;
    display: block;
}

/* Figure image itself — full width of its floated container */
.ds-blog-content figure img {
    width: 100%;
    height: auto;
    margin: 0;
    border-radius: var(--ds-radius);
    display: block;
}

/* Caption */
.ds-blog-content figcaption {
    color: var(--ds-text-muted);
    font-size: 12.5px;
    font-style: italic;
    margin-top: 8px;
    text-align: center;
    letter-spacing: 0.02em;
    line-height: 1.5;
}

/* Explicit author-set alignment — honour it, override the float defaults */
.ds-blog-content .alignleft,
.ds-blog-content figure.alignleft {
    float: left;
    margin: 0.4em 2.8em 2em 0;
    max-width: 46%;
}

.ds-blog-content .alignright,
.ds-blog-content figure.alignright {
    float: right;
    margin: 0.4em 0 2em 2.8em;
    max-width: 46%;
}

.ds-blog-content .aligncenter,
.ds-blog-content figure.aligncenter {
    float: none;
    clear: both;
    display: block;
    margin: 1.8em auto;
    max-width: 100%;
}

.ds-blog-content .alignwide,
.ds-blog-content figure.alignwide {
    float: none;
    clear: both;
    margin-left: -40px;
    margin-right: -40px;
    max-width: calc(100% + 80px);
}

.ds-blog-content .alignfull,
.ds-blog-content figure.alignfull {
    float: none;
    clear: both;
    margin-left: calc(-50vw + 50%);
    margin-right: calc(-50vw + 50%);
    max-width: 100vw;
    width: 100vw;
    border-radius: 0;
}

/* ─── Blockquotes ─────────────────────────────────────── */
.ds-blog-content blockquote,
.ds-blog-content .ds-blog-blockquote {
    margin: 2em 0;
    padding: 20px 24px 20px 28px;
    border-left: 3px solid var(--ds-gold);
    background: rgba(201, 169, 110, 0.06);
    border-radius: 0 var(--ds-radius) var(--ds-radius) 0;
    font-style: italic;
    color: var(--ds-cream);
    clear: both;
}

.ds-blog-content blockquote p:last-child {
    margin-bottom: 0;
}

.ds-blog-content blockquote cite {
    display: block;
    font-size: 13px;
    color: var(--ds-text-muted);
    margin-top: 10px;
    font-style: normal;
    letter-spacing: 0.04em;
}

/* ─── Tables ──────────────────────────────────────────── */
.ds-blog-content table,
.ds-blog-content .ds-blog-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5em 0;
    font-size: 14px;
    clear: both;
}

.ds-blog-content th,
.ds-blog-content td {
    padding: 10px 14px;
    border: 1px solid var(--ds-border);
    text-align: left;
}

.ds-blog-content th {
    background: rgba(201, 169, 110, 0.12);
    color: var(--ds-gold);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.06em;
}

.ds-blog-content tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.02);
}

/* ─── Code Blocks ─────────────────────────────────────── */
.ds-blog-content code {
    background: rgba(255, 255, 255, 0.06);
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.9em;
    font-family: 'Fira Code', 'Consolas', monospace;
    color: var(--ds-gold-light);
}

.ds-blog-content pre,
.ds-blog-content .ds-blog-code {
    background: #1a1a1a;
    padding: 20px;
    border-radius: var(--ds-radius);
    overflow-x: auto;
    margin: 1.5em 0;
    border: 1px solid var(--ds-border);
}

.ds-blog-content pre code {
    background: none;
    padding: 0;
    font-size: 14px;
    color: var(--ds-text);
}

/* ─── Horizontal Rule ─────────────────────────────────── */
.ds-blog-content hr {
    border: none;
    border-top: 1px solid var(--ds-border);
    margin: 3em 0;
    clear: both;
}

/* ─── Embedded Content ────────────────────────────────── */
.ds-blog-content .ds-blog-embed {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 */
    height: 0;
    overflow: hidden;
    margin: 2em 0;
    border-radius: var(--ds-radius-lg);
    clear: both;
}

.ds-blog-content .ds-blog-embed iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

.ds-blog-content .wp-block-embed {
    margin: 2em 0;
    clear: both;
}

.ds-blog-content .wp-block-embed__wrapper {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
    border-radius: var(--ds-radius-lg);
}

.ds-blog-content .wp-block-embed__wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* ─── Gallery ─────────────────────────────────────────── */
.ds-blog-content .ds-blog-gallery,
.ds-blog-content .wp-block-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
    margin: 2em 0;
    float: none;
    clear: both;
}

.ds-blog-content .ds-blog-gallery img,
.ds-blog-content .wp-block-gallery img {
    margin: 0;
    border-radius: var(--ds-radius);
    width: 100%;
    height: 200px;
    object-fit: cover;
}

/* ─── Separator / Spacer ──────────────────────────────── */
.ds-blog-content .wp-block-separator {
    border: none;
    border-top: 1px solid var(--ds-border);
    margin: 2em auto;
    max-width: 100px;
    clear: both;
}

.ds-blog-content .wp-block-separator.is-style-wide {
    max-width: 100%;
}

.ds-blog-content .wp-block-separator.is-style-dots {
    border: none;
    text-align: center;
    max-width: 100%;
}

.ds-blog-content .wp-block-separator.is-style-dots::before {
    content: '···';
    color: var(--ds-gold);
    font-size: 24px;
    letter-spacing: 16px;
}

/* ─── Buttons (Gutenberg) ─────────────────────────────── */
.ds-blog-content .wp-block-button__link {
    background: var(--ds-gold);
    color: var(--ds-black);
    padding: 10px 24px;
    border-radius: var(--ds-radius);
    font-weight: 600;
    text-decoration: none;
    display: inline-block;
    transition: all var(--ds-transition);
}

.ds-blog-content .wp-block-button__link:hover {
    background: var(--ds-gold-light);
    color: var(--ds-black);
}

/* ─── Clearfix ────────────────────────────────────────── */
.ds-blog-content::after {
    content: '';
    display: table;
    clear: both;
}

/* ─── Responsive ──────────────────────────────────────── */
@media (max-width: 768px) {
    .ds-blog-content {
        font-size: 15.5px;
        line-height: 1.8;
    }

    .ds-blog-content h2 { font-size: 24px; }
    .ds-blog-content h3 { font-size: 20px; }

    /* All floats collapse to full-width stacked blocks on mobile */
    .ds-blog-content figure,
    .ds-blog-content figure:nth-of-type(2n),
    .ds-blog-content .wp-block-image,
    .ds-blog-content .wp-block-image:nth-of-type(2n),
    .ds-blog-content p > img,
    .ds-blog-content .alignleft,
    .ds-blog-content .alignright {
        float: none;
        max-width: 100%;
        width: 100%;
        margin: 1.6em 0;
        display: block;
    }

    .ds-blog-content .alignwide {
        margin-left: -16px;
        margin-right: -16px;
        max-width: calc(100% + 32px);
    }

    .ds-blog-content .ds-blog-gallery,
    .ds-blog-content .wp-block-gallery {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 8px;
    }

    .ds-blog-content table {
        display: block;
        overflow-x: auto;
    }
}
