/* ==========================================================================
   HiBlog — Content Layout Styles
   Provides visual styling for AI-generated blog post layouts.
   These classes are applied inside .hiblog-content by the AI prompt builder.
   Variables scoped to .hiblog-content so themes cannot clobber them.
   All selectors prefixed with .hiblog-content for high specificity.

   Architecture
   ────────────
   Base inner-block styles use  .hiblog-content .hiblog-layout .hiblog-<block>
   so every block works inside ANY layout wrapper.
   Layout-specific overrides use .hiblog-content .hiblog-layout--<type> …
   (same specificity — source-order wins, overrides come after base rules).
   ========================================================================== */

.hiblog-content .hiblog-layout {
    --hiblog-accent: var(--hiblog-c-accent, #2563eb);
    --hiblog-accent-rgb: var(--hiblog-c-accent-rgb, 37, 99, 235);
    --hiblog-accent-light: color-mix(in srgb, var(--hiblog-c-accent, #2563eb) 8%, white);
    --hiblog-accent-border: color-mix(in srgb, var(--hiblog-c-accent, #2563eb) 30%, white);
    --hiblog-tip-bg: #f0fdf4;
    --hiblog-tip-border: #86efac;
    --hiblog-tip-text: #166534;
    --hiblog-warning-bg: #fffbeb;
    --hiblog-warning-border: #fcd34d;
    --hiblog-warning-text: #92400e;
    --hiblog-success-bg: #f0fdf4;
    --hiblog-success-border: #86efac;
    --hiblog-success-text: #166534;
    --hiblog-danger-bg: #fef2f2;
    --hiblog-danger-border: #fca5a5;
    --hiblog-danger-text: #991b1b;
    --hiblog-card-bg: #ffffff;
    --hiblog-card-border: var(--hiblog-c-border, #e5e7eb);
    --hiblog-card-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    --hiblog-divider-color: #d1d5db;
    --hiblog-aside-bg: var(--hiblog-c-bg-subtle, #f9fafb);
    --hiblog-aside-border: #9ca3af;
    --hiblog-text-muted: var(--hiblog-c-text-secondary, #6b7280);
    --hiblog-heading-color: var(--hiblog-c-heading, #111827);
    --hiblog-radius: var(--hiblog-c-radius, 6px);
    --hiblog-section-bg: var(--hiblog-c-bg-subtle, #f8fafc);
}


/* ==========================================================================
   UNIVERSAL BLOCK STYLES
   These work inside any .hiblog-layout wrapper regardless of layout type.
   ========================================================================== */


/* --- Pull Quote -----------------------------------------------------------*/

.hiblog-content .hiblog-layout .hiblog-pullquote {
    break-inside: avoid;
    column-span: all;
    margin: 2em 0;
    padding: 1.5em 2em;
    border-left: 5px solid var(--hiblog-accent);
    background: var(--hiblog-accent-light);
    border-radius: 0 var(--hiblog-radius) var(--hiblog-radius) 0;
    font-size: 1.15em;
    font-style: italic;
    line-height: 1.65;
    color: #1e3a5f;
}

.hiblog-content .hiblog-layout .hiblog-pullquote p {
    margin: 0;
}


/* --- Highlight Box --------------------------------------------------------*/

.hiblog-content .hiblog-layout .hiblog-highlight {
    margin: 2em 0;
    padding: 1.1em 1.5em 1.1em 1.3em;
    background: var(--hiblog-accent-light);
    border: 1px solid var(--hiblog-accent-border);
    border-left: 4px solid var(--hiblog-accent);
    border-radius: 0 var(--hiblog-radius) var(--hiblog-radius) 0;
    font-size: 0.95em;
    line-height: 1.55;
    color: #1e3a5f;
    break-inside: avoid;
}

.hiblog-content .hiblog-layout .hiblog-highlight strong {
    display: block;
    color: var(--hiblog-accent);
    font-weight: 700;
    margin-bottom: 0.3em;
    text-transform: uppercase;
    font-size: 0.8em;
    letter-spacing: 0.05em;
}


/* --- Info Bar -------------------------------------------------------------*/

.hiblog-content .hiblog-layout .hiblog-info-bar {
    display: flex;
    flex-wrap: wrap;
    background: var(--hiblog-accent-light);
    border: 1px solid var(--hiblog-accent-border);
    border-radius: var(--hiblog-radius);
    margin-bottom: 1.75em;
    overflow: hidden;
}

.hiblog-content .hiblog-layout .hiblog-info-bar__item {
    flex: 1 1 0;
    min-width: 120px;
    padding: 0.85em 1.25em;
    text-align: center;
    font-size: 0.9em;
    line-height: 1.5;
    border-right: 1px solid var(--hiblog-accent-border);
}

.hiblog-content .hiblog-layout .hiblog-info-bar__item:last-child {
    border-right: none;
}

.hiblog-content .hiblog-layout .hiblog-info-bar__item strong {
    display: block;
    color: var(--hiblog-accent);
    font-weight: 700;
    font-size: 0.8em;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.15em;
}


/* --- Steps & Step ---------------------------------------------------------*/

.hiblog-content .hiblog-layout .hiblog-steps {
    position: relative;
    padding-left: 24px;
    margin: 2em 0;
}

.hiblog-content .hiblog-layout .hiblog-steps::before {
    content: '';
    position: absolute;
    left: 19px;
    top: 24px;
    bottom: 24px;
    width: 3px;
    background: linear-gradient(to bottom, var(--hiblog-accent-border), var(--hiblog-accent), var(--hiblog-accent-border));
    border-radius: 2px;
}

.hiblog-content .hiblog-layout .hiblog-step {
    display: flex;
    gap: 1.25em;
    margin: 0 0 2.25em;
    position: relative;
    padding: 1.25em 1.25em 1.25em 1.75em;
    background: var(--hiblog-card-bg);
    border: 1px solid var(--hiblog-card-border);
    border-radius: var(--hiblog-radius);
    box-shadow: var(--hiblog-card-shadow);
    margin-left: 24px;
}

.hiblog-content .hiblog-layout .hiblog-step__number {
    position: absolute;
    left: -38px;
    top: 1.1em;
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--hiblog-accent);
    color: #ffffff;
    font-weight: 700;
    font-size: 1em;
    border-radius: 50%;
    box-shadow: 0 0 0 4px var(--hiblog-card-bg), 0 0 0 5px var(--hiblog-accent-border);
    z-index: 1;
}

.hiblog-content .hiblog-layout .hiblog-step__body {
    flex: 1;
    min-width: 0;
}

.hiblog-content .hiblog-layout .hiblog-step__body h3 {
    margin: 0 0 0.5em;
    font-size: 1.1em;
    color: var(--hiblog-heading-color);
}

.hiblog-content .hiblog-layout .hiblog-step__body p {
    margin: 0.4em 0 0;
}


/* --- Callouts -------------------------------------------------------------*/

.hiblog-content .hiblog-layout .hiblog-callout {
    margin: 1.5em 0;
    padding: 1em 1.25em 1em 3em;
    border-radius: var(--hiblog-radius);
    border-left: 4px solid;
    position: relative;
}

.hiblog-content .hiblog-layout .hiblog-callout::before {
    position: absolute;
    left: 0.85em;
    top: 1em;
    font-size: 1.1em;
    line-height: 1;
}

.hiblog-content .hiblog-layout .hiblog-callout strong {
    font-weight: 700;
}

.hiblog-content .hiblog-layout .hiblog-callout--tip {
    background: var(--hiblog-tip-bg);
    border-color: var(--hiblog-tip-border);
    color: var(--hiblog-tip-text);
}

.hiblog-content .hiblog-layout .hiblog-callout--tip::before {
    content: '\1F4A1';
}

.hiblog-content .hiblog-layout .hiblog-callout--warning {
    background: var(--hiblog-warning-bg);
    border-color: var(--hiblog-warning-border);
    color: var(--hiblog-warning-text);
}

.hiblog-content .hiblog-layout .hiblog-callout--warning::before {
    content: '\26A0';
}


/* --- Card -----------------------------------------------------------------*/

.hiblog-content .hiblog-layout .hiblog-card {
    display: flex;
    gap: 1.25em;
    align-items: flex-start;
    margin: 1.5em 0;
    padding: 1.5em;
    background: var(--hiblog-card-bg);
    border: 1px solid var(--hiblog-card-border);
    border-left: 4px solid var(--hiblog-accent);
    border-radius: var(--hiblog-radius);
    box-shadow: var(--hiblog-card-shadow);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.hiblog-content .hiblog-layout .hiblog-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

.hiblog-content .hiblog-layout .hiblog-card__number {
    flex-shrink: 0;
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--hiblog-accent), rgba(var(--hiblog-accent-rgb), 0.8));
    color: #ffffff;
    font-weight: 800;
    font-size: 1.35em;
    border-radius: var(--hiblog-radius);
}

.hiblog-content .hiblog-layout .hiblog-card__body {
    flex: 1;
    min-width: 0;
}

.hiblog-content .hiblog-layout .hiblog-card__body h3 {
    margin: 0 0 0.5em;
    font-size: 1.15em;
    color: var(--hiblog-heading-color);
}

.hiblog-content .hiblog-layout .hiblog-card__body p {
    margin: 0.4em 0 0;
}


/* --- Verdict --------------------------------------------------------------*/

.hiblog-content .hiblog-layout .hiblog-verdict {
    margin: 2.5em 0 1em;
    padding: 1.5em 1.75em;
    background: var(--hiblog-accent-light);
    border: 2px solid var(--hiblog-accent);
    border-radius: var(--hiblog-radius);
}

.hiblog-content .hiblog-layout .hiblog-verdict strong {
    display: block;
    color: var(--hiblog-accent);
    font-weight: 700;
    font-size: 0.85em;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5em;
}

.hiblog-content .hiblog-layout .hiblog-verdict p {
    margin: 0;
    font-size: 1.05em;
    line-height: 1.6;
}


/* --- Divider --------------------------------------------------------------*/

.hiblog-content .hiblog-layout .hiblog-divider {
    margin: 3em auto;
    width: auto;
    height: auto;
    border: none;
    text-align: center;
    line-height: 1;
    font-size: 1.5em;
    letter-spacing: 0.5em;
    color: var(--hiblog-divider-color);
}

.hiblog-content .hiblog-layout .hiblog-divider::before {
    content: '\2022\2009\2022\2009\2022';
}


/* --- Aside ----------------------------------------------------------------*/

.hiblog-content .hiblog-layout .hiblog-aside {
    margin: 2.5em 0;
    padding: 1.75em 2.5em;
    background: var(--hiblog-aside-bg);
    border-left: 3px solid var(--hiblog-aside-border);
    border-radius: 0 var(--hiblog-radius) var(--hiblog-radius) 0;
    font-style: italic;
    color: var(--hiblog-text-muted);
    line-height: 1.7;
}

.hiblog-content .hiblog-layout .hiblog-aside p {
    margin: 0;
}


/* --- FAQ Item -------------------------------------------------------------*/

.hiblog-content .hiblog-layout .hiblog-faq {
    margin: 0 0 0.5em;
    border-radius: var(--hiblog-radius);
    overflow: hidden;
}

.hiblog-content .hiblog-layout .hiblog-faq:nth-child(odd) {
    background: var(--hiblog-section-bg);
}

.hiblog-content .hiblog-layout .hiblog-faq__question {
    position: relative;
    padding: 1em 1.25em 0.75em 3.5em;
    margin: 0;
    font-size: 1.1em;
    font-weight: 600;
    color: var(--hiblog-heading-color);
    cursor: default;
}

.hiblog-content .hiblog-layout .hiblog-faq__question::before {
    content: 'Q';
    position: absolute;
    left: 1em;
    top: 1em;
    width: 1.7em;
    height: 1.7em;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--hiblog-accent);
    color: #ffffff;
    font-size: 0.75em;
    font-weight: 800;
    border-radius: 50%;
    line-height: 1;
}

.hiblog-content .hiblog-layout .hiblog-faq__answer {
    padding: 0 1.25em 1.25em 3.5em;
    line-height: 1.7;
}

.hiblog-content .hiblog-layout .hiblog-faq__answer > p:first-child {
    margin-top: 0;
}

.hiblog-content .hiblog-layout .hiblog-faq__answer > p:last-child {
    margin-bottom: 0;
}


/* --- Compare --------------------------------------------------------------*/

.hiblog-content .hiblog-layout .hiblog-compare {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5em;
    margin: 2em 0;
}

.hiblog-content .hiblog-layout .hiblog-compare__column {
    padding: 1.5em;
    background: var(--hiblog-card-bg);
    border: 1px solid var(--hiblog-card-border);
    border-radius: var(--hiblog-radius);
    box-shadow: var(--hiblog-card-shadow);
}

.hiblog-content .hiblog-layout .hiblog-compare__column h3 {
    margin-top: 0;
    margin-bottom: 0.75em;
    padding-bottom: 0.75em;
    border-bottom: 2px solid var(--hiblog-accent);
    color: var(--hiblog-heading-color);
    font-size: 1.15em;
}

.hiblog-content .hiblog-layout .hiblog-compare__column p:first-of-type {
    margin-top: 0;
}


/* --- Pros & Cons ----------------------------------------------------------*/

.hiblog-content .hiblog-layout .hiblog-pros-cons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5em;
    margin: 2em 0;
}

.hiblog-content .hiblog-layout .hiblog-pros-cons__pros {
    padding: 1.25em 1.5em;
    background: var(--hiblog-success-bg);
    border: 1px solid var(--hiblog-success-border);
    border-radius: var(--hiblog-radius);
}

.hiblog-content .hiblog-layout .hiblog-pros-cons__pros h4 {
    margin: 0 0 0.75em;
    color: var(--hiblog-success-text);
    font-weight: 700;
    font-size: 1em;
}

.hiblog-content .hiblog-layout .hiblog-pros-cons__pros ul {
    margin: 0;
    padding-left: 1.25em;
}

.hiblog-content .hiblog-layout .hiblog-pros-cons__pros li {
    color: var(--hiblog-success-text);
    margin-bottom: 0.3em;
}

.hiblog-content .hiblog-layout .hiblog-pros-cons__cons {
    padding: 1.25em 1.5em;
    background: var(--hiblog-danger-bg);
    border: 1px solid var(--hiblog-danger-border);
    border-radius: var(--hiblog-radius);
}

.hiblog-content .hiblog-layout .hiblog-pros-cons__cons h4 {
    margin: 0 0 0.75em;
    color: var(--hiblog-danger-text);
    font-weight: 700;
    font-size: 1em;
}

.hiblog-content .hiblog-layout .hiblog-pros-cons__cons ul {
    margin: 0;
    padding-left: 1.25em;
}

.hiblog-content .hiblog-layout .hiblog-pros-cons__cons li {
    color: var(--hiblog-danger-text);
    margin-bottom: 0.3em;
}


/* --- Showcase Section -----------------------------------------------------*/

.hiblog-content .hiblog-layout .hiblog-showcase {
    padding: 2.5em 2.5em;
    text-align: center;
}

.hiblog-content .hiblog-layout .hiblog-showcase h2 {
    margin-top: 0;
    margin-bottom: 0.75em;
    font-size: 1.4em;
    color: var(--hiblog-heading-color);
}

.hiblog-content .hiblog-layout .hiblog-showcase p {
    max-width: 680px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.75;
}

.hiblog-content .hiblog-layout .hiblog-showcase ul,
.hiblog-content .hiblog-layout .hiblog-showcase ol {
    display: inline-block;
    text-align: left;
    max-width: 680px;
}

.hiblog-content .hiblog-layout .hiblog-showcase--hero {
    background: var(--hiblog-accent-light);
    padding: 3.5em 2.5em;
    border-bottom: 3px solid var(--hiblog-accent);
}

.hiblog-content .hiblog-layout .hiblog-showcase--hero h2 {
    font-size: 1.75em;
    color: var(--hiblog-accent);
}

.hiblog-content .hiblog-layout .hiblog-showcase--hero p {
    font-size: 1.15em;
}


/* ==========================================================================
   LAYOUT-SPECIFIC WRAPPER & OVERRIDE STYLES
   Only for the wrapper itself, direct-child typography, or blocks that
   genuinely look different in a particular layout.
   ========================================================================== */


/* --- Magazine Layout ------------------------------------------------------*/

.hiblog-content .hiblog-layout--magazine .hiblog-intro {
    font-size: 1.25em;
    line-height: 1.7;
    font-weight: 500;
    color: var(--hiblog-heading-color);
    margin-bottom: 1.75em;
}

.hiblog-content .hiblog-layout--magazine .hiblog-intro::first-letter {
    float: left;
    font-size: 3.6em;
    line-height: 0.8;
    padding-right: 0.08em;
    padding-top: 0.05em;
    font-weight: 700;
    color: var(--hiblog-accent);
}

.hiblog-content .hiblog-layout--magazine > h2 {
    border-top: 1px solid var(--hiblog-card-border);
    padding-top: 1.5em;
    margin-top: 2.5em;
}

.hiblog-content .hiblog-layout--magazine > h2:first-of-type {
    border-top: none;
    padding-top: 0;
}

.hiblog-content .hiblog-layout--magazine .hiblog-columns {
    columns: 2;
    column-gap: 2.5em;
    column-rule: 1px solid var(--hiblog-card-border);
    margin-bottom: 1.5em;
}

.hiblog-content .hiblog-layout--magazine .hiblog-columns > p {
    margin-top: 0;
}


/* --- Storyteller Layout ---------------------------------------------------*/

.hiblog-content .hiblog-layout--storyteller {
    max-width: 680px;
    margin-left: auto;
    margin-right: auto;
}

.hiblog-content .hiblog-layout--storyteller > p {
    font-size: 1.05em;
    line-height: 1.85;
    margin-bottom: 1.35em;
}

.hiblog-content .hiblog-layout--storyteller > h2 {
    margin-top: 2.5em;
    margin-bottom: 1em;
    font-size: 1.5em;
    letter-spacing: -0.01em;
}

.hiblog-content .hiblog-layout--storyteller .hiblog-lead {
    font-size: 1.35em;
    line-height: 1.7;
    font-weight: 300;
    color: var(--hiblog-heading-color);
    margin-bottom: 2em;
}

.hiblog-content .hiblog-layout--storyteller .hiblog-aside {
    margin-left: -2.5em;
    margin-right: -2.5em;
}


/* --- Listicle Layout overrides --------------------------------------------*/

.hiblog-content .hiblog-layout--listicle .hiblog-card:nth-child(even) {
    flex-direction: row-reverse;
    border-left: 1px solid var(--hiblog-card-border);
    border-right: 4px solid var(--hiblog-accent);
}


/* --- Showcase Layout overrides --------------------------------------------*/

.hiblog-content .hiblog-layout--showcase {
    margin-left: -1.5em;
    margin-right: -1.5em;
}

.hiblog-content .hiblog-layout--showcase .hiblog-showcase:nth-child(even) {
    background: var(--hiblog-section-bg);
}


/* ==========================================================================
   Responsive adjustments
   ========================================================================== */

@media (max-width: 768px) {

    /* Universal block adjustments */
    .hiblog-content .hiblog-layout .hiblog-info-bar__item {
        min-width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--hiblog-accent-border);
        text-align: left;
    }

    .hiblog-content .hiblog-layout .hiblog-info-bar__item:last-child {
        border-bottom: none;
    }

    .hiblog-content .hiblog-layout .hiblog-info-bar__item strong {
        display: inline;
    }

    .hiblog-content .hiblog-layout .hiblog-card__number {
        width: 42px;
        height: 42px;
        font-size: 1.1em;
    }

    .hiblog-content .hiblog-layout .hiblog-compare,
    .hiblog-content .hiblog-layout .hiblog-pros-cons {
        grid-template-columns: 1fr;
    }

    /* Layout-specific adjustments */
    .hiblog-content .hiblog-layout--magazine .hiblog-columns {
        columns: 1;
    }

    .hiblog-content .hiblog-layout--magazine .hiblog-intro::first-letter {
        font-size: 2.8em;
    }

    .hiblog-content .hiblog-layout--listicle .hiblog-card,
    .hiblog-content .hiblog-layout--listicle .hiblog-card:nth-child(even) {
        flex-direction: row;
        border-left: 4px solid var(--hiblog-accent);
        border-right: 1px solid var(--hiblog-card-border);
    }

    .hiblog-content .hiblog-layout--storyteller .hiblog-aside {
        margin-left: 0;
        margin-right: 0;
    }

    .hiblog-content .hiblog-layout--showcase {
        margin-left: -0.75em;
        margin-right: -0.75em;
    }

    .hiblog-content .hiblog-layout--showcase .hiblog-showcase {
        padding: 1.75em 1.25em;
    }

    .hiblog-content .hiblog-layout--showcase .hiblog-showcase--hero {
        padding: 2.5em 1.25em;
    }
}

@media (max-width: 480px) {

    /* Universal block adjustments */
    .hiblog-content .hiblog-layout .hiblog-step {
        flex-direction: column;
        margin-left: 16px;
        padding-left: 1.25em;
    }

    .hiblog-content .hiblog-layout .hiblog-step__number {
        position: static;
        width: 36px;
        height: 36px;
        font-size: 0.9em;
        box-shadow: none;
    }

    .hiblog-content .hiblog-layout .hiblog-steps {
        padding-left: 0;
    }

    .hiblog-content .hiblog-layout .hiblog-steps::before {
        display: none;
    }

    .hiblog-content .hiblog-layout .hiblog-card {
        flex-direction: column;
        gap: 0.75em;
    }

    /* Layout-specific adjustments */
    .hiblog-content .hiblog-layout--magazine .hiblog-intro,
    .hiblog-content .hiblog-layout--storyteller .hiblog-lead {
        font-size: 1.1em;
    }

    .hiblog-content .hiblog-layout--storyteller > p {
        font-size: 1em;
    }
}
