/**
 * Gutenberg Styles for Classic Theme
 * 
 * Works with WordPress 6.x native layout system.
 * Only adds what's missing or needs media query support.
 *
 * Breakpoints:
 *   - >= 768px: 40px horizontal padding
 *   - < 768px:  20px horizontal padding
 */

/* ==========================================================================
   Responsive Root Padding
   theme.json doesn't support media queries - must handle here
   ========================================================================== */

@media (max-width: 767px) {
    body {
        --wp--style--root--padding-left: 20px;
        --wp--style--root--padding-right: 20px;
    }
}

/* ==========================================================================
   Entry Content Container
   ========================================================================== */

/**
 * Fallback padding if .has-global-padding is not present
 */
.entry-content:not(.has-global-padding) {
    padding-left: var(--wp--style--root--padding-left, 40px);
    padding-right: var(--wp--style--root--padding-right, 40px);
}

/**
 * Fallback layout constraints if .is-layout-constrained is not present
 */
.entry-content:not(.is-layout-constrained) > *:not(.alignwide):not(.alignfull):not(.alignleft):not(.alignright) {
    max-width: var(--wp--style--global--content-size, 1280px);
    margin-left: auto;
    margin-right: auto;
}

.entry-content:not(.is-layout-constrained) > .alignwide {
    max-width: var(--wp--style--global--wide-size, 1440px);
    margin-left: auto;
    margin-right: auto;
}

/* ==========================================================================
   Full Width Alignment Fix
   WordPress sets negative margins but NOT explicit width - we fix that
   ========================================================================== */

/**
 * Direct children of entry-content with alignfull
 */
.entry-content > .alignfull,
.entry-content.has-global-padding > .alignfull {
    width: calc(100% + var(--wp--style--root--padding-left, 40px) + var(--wp--style--root--padding-right, 40px));
    max-width: none;
    margin-left: calc(-1 * var(--wp--style--root--padding-left, 40px));
    margin-right: calc(-1 * var(--wp--style--root--padding-right, 40px));
    box-sizing: border-box;
}

/**
 * Nested alignfull inside a full-width block with .has-global-padding
 * e.g., alignfull inside alignfull
 */
.entry-content .alignfull.has-global-padding > .alignfull {
    width: calc(100% + var(--wp--style--root--padding-left, 40px) + var(--wp--style--root--padding-right, 40px));
    max-width: none;
    margin-left: calc(-1 * var(--wp--style--root--padding-left, 40px));
    margin-right: calc(-1 * var(--wp--style--root--padding-right, 40px));
}

/**
 * Nested alignfull inside constrained layout (already inside a full-width parent)
 * These should NOT break out further - reset to 100%
 */
.entry-content .alignfull .is-layout-constrained:not(.alignfull) > .alignfull {
    width: 100%;
    margin-left: 0;
    margin-right: 0;
}

/* ==========================================================================
   Wide Alignment
   ========================================================================== */

.entry-content > .alignwide,
.entry-content.has-global-padding > .alignwide {
    max-width: var(--wp--style--global--wide-size, 1440px);
    margin-left: auto;
    margin-right: auto;
}

/* ==========================================================================
   Float Alignments
   ========================================================================== */

.alignleft {
    float: left;
    margin-right: 24px;
    margin-bottom: 12px;
    max-width: 50%;
}

.alignright {
    float: right;
    margin-left: 24px;
    margin-bottom: 12px;
    max-width: 50%;
}

@media (max-width: 767px) {
    .alignleft,
    .alignright {
        float: none;
        max-width: 100%;
        margin-left: 0;
        margin-right: 0;
    }
}

/* ==========================================================================
   Core Block Refinements
   ========================================================================== */

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

.wp-block-image.alignfull img,
.wp-block-image.alignwide img {
    width: 100%;
}

.wp-block-button__link {
    font-family: "NT Bau", sans-serif;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.wp-block-quote {
    border-left: 4px solid currentColor;
    padding-left: 24px;
    margin-left: 0;
    margin-right: 0;
    font-style: italic;
}

.wp-block-quote cite {
    font-style: normal;
    font-size: 14px;
    display: block;
    margin-top: 12px;
}

.wp-block-separator:not(.is-style-dots) {
    border: none;
    border-top: 1px solid currentColor;
    opacity: 0.2;
}

.wp-block-table {
    overflow-x: auto;
}

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

.wp-block-table td,
.wp-block-table th {
    padding: 12px;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.wp-block-list {
    padding-left: 24px;
}

.wp-block-code,
.wp-block-preformatted {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 14px;
    padding: 20px 24px;
    overflow-x: auto;
    background: rgba(0, 0, 0, 0.03);
    border-radius: 4px;
}

/* Responsive video embeds */
.wp-block-embed-youtube .wp-block-embed__wrapper,
.wp-block-embed-vimeo .wp-block-embed__wrapper {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
}

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

/* ==========================================================================
   Typography
   ========================================================================== */

.entry-content h1,
.entry-content h2,
.entry-content h3,
.entry-content h4,
.entry-content h5,
.entry-content h6 {
    margin-top: clamp(clamp(clamp(30px, 0.23vw + 29.13px, 30.7px), 1.55vw + 20.22px, 35.36px), 4.19vw + -5.57px, 48px);
    margin-bottom: clamp(clamp(clamp(12px, 0.05vw + 11.81px, 12.16px), 0.34vw + 9.83px, 13.19px), 0.93vw + 4.09px, 16px);
}

.entry-content > h1:first-child,
.entry-content > h2:first-child,
.entry-content > h3:first-child,
.entry-content > h4:first-child,
.entry-content > h5:first-child,
.entry-content > h6:first-child {
    margin-top: 0;
}

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

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

@media print {
    .alignfull,
    .alignwide {
        max-width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        width: 100% !important;
    }
}