/**
 * Gutenberg Brand Block Styles — Tanamas Group
 *
 * Makes all default WordPress/Gutenberg blocks match the brand design system.
 * Loaded AFTER main.css and Tailwind compiled CSS.
 *
 * @version 1.0.5
 * @package Tanamas_Group
 */

/* ================================================================
   TYPOGRAPHY OVERRIDES — Neutralize WP utility classes on FRONTEND only
   (Editor must allow color/font/size changes from sidebar)
   ================================================================ */

/* Only override on frontend — skip inside .editor-styles-wrapper (Gutenberg editor) */
body:not(.wp-admin):not(.editor-styles-wrapper) .has-small-font-size,
body:not(.wp-admin):not(.editor-styles-wrapper) .has-medium-font-size,
body:not(.wp-admin):not(.editor-styles-wrapper) .has-large-font-size,
body:not(.wp-admin):not(.editor-styles-wrapper) .has-x-large-font-size { font-size: inherit !important; }

/* NOTE: .has-text-color and .has-background intentionally NOT overridden here.
   Color/background classes from Gutenberg sidebar must work on both editor and frontend. */

/* === Tailwind Grid Pass-Through === */
/* Gutenberg's wp:group wraps content in .wp-block-group__inner-container div,
   which breaks CSS Grid layouts (children become items of the inner container,
   not the grid). This fix makes the inner container transparent for groups
   that use Tailwind grid/flex classes via the tanamas-layout marker class. */
.wp-block-group.tanamas-layout > .wp-block-group__inner-container {
    display: contents;
}

/* === Gutenberg Layout Flow Neutralization === */
/* Gutenberg adds .is-layout-flow to every group and applies:
     :root :where(.is-layout-flow) > * { margin-block-start: 24px; }
   We neutralize ONLY margin-block-start (the WP-injected 24px).
   margin-block-end is LEFT ALONE so Tailwind mb-* utilities work normally. */
:root :where(.is-layout-flow) > * {
    margin-block-start: 0;
}
body :where(.is-layout-flow) > * {
    margin-block-start: 0;
}

/* === Gutenberg Column Neutralization === */
/* Strip ALL default WP column styles so Tailwind classes control layout. */
body .wp-block-columns,
.editor-styles-wrapper .wp-block-columns {
    display: flex !important;
    flex-wrap: wrap;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
}

body .wp-block-column,
.editor-styles-wrapper .wp-block-column {
    flex: 1 1 0%; /* Equal-width columns by default */
    margin: 0 !important;
    padding: 0 !important;
    min-width: 0;
}

/* wp-block-column inner wrapper should be transparent */
.wp-block-column > .wp-block-group__inner-container {
    display: contents;
}

/* On mobile, stack columns vertically (unless data attribute says otherwise) */
@media (max-width: 781px) {
    body .wp-block-columns,
    .editor-styles-wrapper .wp-block-columns {
        flex-direction: column;
    }
    body .wp-block-column,
    .editor-styles-wrapper .wp-block-column {
        flex: 1 1 100%;
    }
}

/* === Group Inner Container Reset === */
/* Remove default padding from group inner containers so our patterns
   have full control over spacing via Tailwind classes. */
body .wp-block-group > .wp-block-group__inner-container,
.editor-styles-wrapper .wp-block-group > .wp-block-group__inner-container {
    padding: 0;
    margin: 0;
    max-width: 100%;
}

/* === Image Block Reset === */
/* Remove default figure margin so images sit flush in patterns. */
body .wp-block-image,
.editor-styles-wrapper .wp-block-image {
    margin: 0;
}

body .wp-block-image figure,
.editor-styles-wrapper .wp-block-image figure {
    margin: 0;
}
/* ================================================================
   HEADINGS (h1–h6) — Poppins, brand sizes, brand colors
   ================================================================ */

body .wp-block-heading,
.editor-styles-wrapper .wp-block-heading {
    font-family: 'Poppins', sans-serif;
    line-height: 1.3;
}

body h1,
.editor-styles-wrapper h1,
body .wp-block-heading h1,
.editor-styles-wrapper .wp-block-heading h1 {
    font-size: 2.25rem;
    font-weight: 800;
    margin-top: 0;
    margin-bottom: 0;
}

@media (min-width: 640px) {
    body h1, .editor-styles-wrapper h1,
    body .wp-block-heading h1, .editor-styles-wrapper .wp-block-heading h1 {
        font-size: 3rem;
    }
}
@media (min-width: 1024px) {
    body h1, .editor-styles-wrapper h1,
    body .wp-block-heading h1, .editor-styles-wrapper .wp-block-heading h1 {
        font-size: 3.75rem;
    }
}

body h2,
.editor-styles-wrapper h2,
body .wp-block-heading h2,
.editor-styles-wrapper .wp-block-heading h2 {
    font-size: 1.875rem;
    font-weight: 800;
    margin-top: 0;
    margin-bottom: 0;
}

@media (min-width: 640px) {
    body h2, .editor-styles-wrapper h2,
    body .wp-block-heading h2, .editor-styles-wrapper .wp-block-heading h2 {
        font-size: 2.25rem;
    }
}

body h3,
.editor-styles-wrapper h3,
body .wp-block-heading h3,
.editor-styles-wrapper .wp-block-heading h3 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-top: 0;
    margin-bottom: 0;
}

@media (min-width: 640px) {
    body h3, .editor-styles-wrapper h3,
    body .wp-block-heading h3, .editor-styles-wrapper .wp-block-heading h3 {
        font-size: 1.5rem;
    }
}

body h4,
.editor-styles-wrapper h4,
body .wp-block-heading h4,
.editor-styles-wrapper .wp-block-heading h4 {
    font-size: 1.125rem;
    font-weight: 700;
    margin-top: 0;
    margin-bottom: 0;
}

body h5,
.editor-styles-wrapper h5,
body .wp-block-heading h5,
.editor-styles-wrapper .wp-block-heading h5 {
    font-size: 1rem;
    font-weight: 600;
    margin-top: 0;
    margin-bottom: 0;
}

body h6,
.editor-styles-wrapper h6,
body .wp-block-heading h6,
.editor-styles-wrapper .wp-block-heading h6 {
    font-size: 0.875rem;
    font-weight: 600;
    margin-top: 0;
    margin-bottom: 0;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #4B5563;
}

/* ================================================================
   PARAGRAPH — Montserrat, brand line-height & color
   ================================================================ */

body :where(.wp-block-paragraph),
.editor-styles-wrapper :where(.wp-block-paragraph) {
    font-family: 'Montserrat', sans-serif;
    font-size: 1rem;
    line-height: 1.7;
    color: #222222;
}

/* ================================================================
   LINKS — Sky Blue, hover darker
   ================================================================ */

body :where(.wp-block-paragraph a:not([class*="text-"])),
body :where(.entry-content a:not([class*="text-"])),
body :where(.wp-block-list a:not([class*="text-"])),
body :where(.wp-block-quote a:not([class*="text-"])),
.editor-styles-wrapper a:not([class*="text-"]) {
    color: #5AB4E5;
    text-decoration: none;
    transition: color 0.2s ease;
}

body :where(.wp-block-paragraph a:not([class*="text-"]):hover),
body :where(.entry-content a:not([class*="text-"]):hover),
body :where(.wp-block-list a:not([class*="text-"]):hover),
body :where(.wp-block-quote a:not([class*="text-"]):hover),
.editor-styles-wrapper a:not([class*="text-"]):hover {
    color: #3A9BD4;
    text-decoration: underline;
}

/* ================================================================
   INLINE FORMATTING — strong, em, code, mark
   ================================================================ */

body strong, body b, .editor-styles-wrapper strong {
    font-weight: 700;
}

body em, body i, .editor-styles-wrapper em {
    font-style: italic;
}

body mark, .editor-styles-wrapper mark {
    background-color: #FEF3C7;
    color: #92400E;
    padding: 0.125rem 0.25rem;
    border-radius: 0.25rem;
}

/* ================================================================
   LIST BLOCK — Custom bullets, nesting, spacing
   ================================================================ */

body :where(.wp-block-list),
.editor-styles-wrapper :where(.wp-block-list) {
    font-family: 'Montserrat', sans-serif;
    font-size: 1rem;
    line-height: 1.8;
    color: #222222;
}

body .wp-block-list > li::marker,
.editor-styles-wrapper .wp-block-list > li::marker {
    color: #5AB4E5;
    font-size: 1.1em;
    font-weight: 600;
}

body .wp-block-list li,
.editor-styles-wrapper .wp-block-list li {
    margin-bottom: 0.375rem;
    padding-left: 0.25rem;
}

/* ================================================================
   BLOCKQUOTE — Brand border + bg + italic
   ================================================================ */

body :where(.wp-block-quote),
.editor-styles-wrapper :where(.wp-block-quote) {
    border-left: 5px solid #5AB4E5;
    background-color: #EBF6FD;
    border-radius: 0 0.75rem 0.75rem 0;
}

body .wp-block-quote p,
.editor-styles-wrapper .wp-block-quote p {
    font-family: 'Montserrat', sans-serif;
    font-style: italic;
    font-size: 1.05rem;
    line-height: 1.7;
    color: #222222;
    margin-bottom: 0.75rem;
}

body .wp-block-quote p:last-child,
.editor-styles-wrapper .wp-block-quote p:last-child {
    margin-bottom: 0;
}

body .wp-block-quote cite,
body .wp-block-quote .wp-block-quote__citation,
.editor-styles-wrapper .wp-block-quote cite,
.editor-styles-wrapper .wp-block-quote .wp-block-quote__citation {
    display: block;
    margin-top: 0.75rem;
    font-size: 0.875rem;
    font-style: normal;
    font-weight: 600;
    color: #5AB4E5;
}

/* ================================================================
   PULLQUOTE — Brand border accent
   ================================================================ */

body .wp-block-pullquote,
.editor-styles-wrapper .wp-block-pullquote {
    margin: 2rem 0;
    padding: 2rem 1.5rem;
    border-top: 4px solid #5AB4E5;
    border-bottom: 4px solid #5AB4E5;
    text-align: center;
}

body .wp-block-pullquote p,
.editor-styles-wrapper .wp-block-pullquote p {
    font-family: 'Poppins', sans-serif;
    font-size: 1.5rem;
    font-weight: 600;
    line-height: 1.5;
    color: #222222;
}

body .wp-block-pullquote cite,
body .wp-block-pullquote .wp-block-pullquote__citation,
.editor-styles-wrapper .wp-block-pullquote cite,
.editor-styles-wrapper .wp-block-pullquote .wp-block-pullquote__citation {
    font-family: 'Montserrat', sans-serif;
    font-size: 0.875rem;
    font-style: normal;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #5AB4E5;
    margin-top: 1rem;
}

/* ================================================================
   BUTTON — Primary, outline, hover states
   ================================================================ */

body :where(.wp-block-buttons),
.editor-styles-wrapper :where(.wp-block-buttons) {
    display: flex;
    flex-wrap: wrap;
}

body :where(.wp-block-button),
.editor-styles-wrapper :where(.wp-block-button) {
    display: inline-flex;
}

body .wp-block-button__link,
.editor-styles-wrapper .wp-block-button__link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    font-size: 0.875rem;
    line-height: 1;
    padding: 0.875rem 2rem;
    border-radius: 0.5rem;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

body .wp-block-button__link:not(.has-text-color),
.editor-styles-wrapper .wp-block-button__link:not(.has-text-color) {
    background-color: #5AB4E5;
    color: #FFFFFF;
}

body .wp-block-button__link:not(.has-text-color):hover,
.editor-styles-wrapper .wp-block-button__link:not(.has-text-color):hover {
    background-color: #3A9BD4;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(90, 180, 229, 0.3);
}

body .wp-block-button.is-style-outline .wp-block-button__link,
.editor-styles-wrapper .wp-block-button.is-style-outline .wp-block-button__link {
    background-color: transparent;
    color: #5AB4E5;
    border-color: #5AB4E5;
}

body .wp-block-button.is-style-outline .wp-block-button__link:hover,
.editor-styles-wrapper .wp-block-button.is-style-outline .wp-block-button__link:hover {
    background-color: #5AB4E5;
    color: #FFFFFF;
}

/* ================================================================
   IMAGE — Border-radius, shadow, figcaption
   ================================================================ */

body :where(.wp-block-image),
.editor-styles-wrapper :where(.wp-block-image) {
    margin: 0;
}

body :where(.wp-block-image) img,
.editor-styles-wrapper :where(.wp-block-image) img {
    max-width: 100%;
}

body .wp-block-image figcaption,
.editor-styles-wrapper .wp-block-image figcaption {
    font-family: 'Montserrat', sans-serif;
    font-size: 0.8rem;
    color: #6B7280;
    text-align: center;
    margin-top: 0.75rem;
    line-height: 1.5;
}

/* ================================================================
   SEPARATOR — Brand color, width variants
   ================================================================ */

body .wp-block-separator,
.editor-styles-wrapper :where(.wp-block-separator) {
    border: none;
    border-top: 2px solid #E5E7EB;
}

body .wp-block-separator.is-style-dots,
.editor-styles-wrapper .wp-block-separator.is-style-dots {
    border-top: none;
    text-align: center;
    height: auto;
    line-height: 1;
    color: #5AB4E5;
    font-size: 1.5rem;
    letter-spacing: 1em;
    margin: 2rem 0;
}

/* ================================================================
   TABLE — Header bg, striping, responsive
   ================================================================ */

body :where(.wp-block-table),
.editor-styles-wrapper :where(.wp-block-table) {
    overflow-x: auto;
    border-radius: 0.5rem;
    border: 1px solid #E5E7EB;
}

body .wp-block-table table,
.editor-styles-wrapper .wp-block-table table {
    width: 100%;
    border-collapse: collapse;
    font-family: 'Montserrat', sans-serif;
}

body .wp-block-table thead th,
.editor-styles-wrapper .wp-block-table thead th {
    background-color: #5AB4E5;
    color: #FFFFFF;
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.75rem 1rem;
    text-align: left;
}

body .wp-block-table tbody th,
.editor-styles-wrapper .wp-block-table tbody th {
    background-color: #F3F4F6;
    font-weight: 600;
    padding: 0.625rem 1rem;
    text-align: left;
    border-bottom: 1px solid #E5E7EB;
}

body .wp-block-table td,
.editor-styles-wrapper .wp-block-table td {
    padding: 0.625rem 1rem;
    border-bottom: 1px solid #E5E7EB;
    font-size: 0.9375rem;
    line-height: 1.5;
    color: #222222;
}

body .wp-block-table.is-style-stripes tbody tr:nth-child(even),
.editor-styles-wrapper .wp-block-table.is-style-stripes tbody tr:nth-child(even) {
    background-color: #F9FAFB;
}

/* ================================================================
   GROUP — Container reset
   Use :where() for zero specificity so Tailwind padding/margin
   utilities (p-6, py-20, etc.) always win.
   ================================================================ */

body :where(.wp-block-group),
.editor-styles-wrapper :where(.wp-block-group) {
    margin-top: 0;
    margin-bottom: 0;
}

body :where(.wp-block-group.has-background),
.editor-styles-wrapper :where(.wp-block-group.has-background) {
    padding: 2rem;
}

/* ================================================================
   COVER — Text styling inside cover
   ================================================================ */

body .wp-block-cover,
.editor-styles-wrapper .wp-block-cover {
    min-height: 400px;
    border-radius: 0.75rem;
    overflow: hidden;
}

body .wp-block-cover h1, body .wp-block-cover h2, body .wp-block-cover h3,
body .wp-block-cover h4, body .wp-block-cover h5, body .wp-block-cover h6,
body .wp-block-cover p,
.editor-styles-wrapper .wp-block-cover h1, .editor-styles-wrapper .wp-block-cover h2,
.editor-styles-wrapper .wp-block-cover h3, .editor-styles-wrapper .wp-block-cover h4,
.editor-styles-wrapper .wp-block-cover h5, .editor-styles-wrapper .wp-block-cover h6,
.editor-styles-wrapper .wp-block-cover p {
    color: #FFFFFF;
}

body .wp-block-cover__inner-container,
.editor-styles-wrapper .wp-block-cover__inner-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 2rem;
}

/* ================================================================
   MEDIA & TEXT — Spacing
   ================================================================ */

body .wp-block-media-text,
.editor-styles-wrapper .wp-block-media-text {
    margin: 1.5rem 0;
    border-radius: 0.75rem;
    overflow: hidden;
}

body .wp-block-media-text__content,
.editor-styles-wrapper .wp-block-media-text__content {
    padding: 2rem;
    font-family: 'Montserrat', sans-serif;
}

/* ================================================================
   CODE / PREFORMATTED — Monospace, bg
   ================================================================ */

body .wp-block-code,
.editor-styles-wrapper .wp-block-code {
    background-color: #F3F4F6;
    border: 1px solid #E5E7EB;
    border-radius: 0.5rem;
    padding: 1.25rem;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.875rem;
    line-height: 1.6;
    overflow-x: auto;
    color: #222222;
}

body .wp-block-preformatted,
.editor-styles-wrapper .wp-block-preformatted {
    background-color: #F3F4F6;
    border-radius: 0.5rem;
    padding: 1.25rem;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.875rem;
    line-height: 1.6;
    overflow-x: auto;
    white-space: pre-wrap;
}

/* ================================================================
   VERSE — Poetic styling
   ================================================================ */

body .wp-block-verse,
.editor-styles-wrapper .wp-block-verse {
    font-family: 'Poppins', sans-serif;
    font-style: italic;
    line-height: 1.8;
    color: #4B5563;
    padding: 1.5rem;
    border-left: 3px solid #EFAA34;
    background-color: #FFFBEB;
    border-radius: 0 0.5rem 0.5rem 0;
    margin: 1.5rem 0;
}

/* ================================================================
   SEARCH — Input + Button brand styling
   ================================================================ */

body .wp-block-search,
.editor-styles-wrapper .wp-block-search {
    margin: 1rem 0;
}

body .wp-block-search__input,
.editor-styles-wrapper .wp-block-search__input {
    border: 1px solid #D1D5DB;
    border-radius: 0.5rem 0 0 0.5rem;
    padding: 0.75rem 1rem;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.875rem;
    color: #222222;
    background-color: #FFFFFF;
    transition: border-color 0.2s ease;
}

body .wp-block-search__input:focus,
.editor-styles-wrapper .wp-block-search__input:focus {
    border-color: #5AB4E5;
    outline: none;
    box-shadow: 0 0 0 3px rgba(90, 180, 229, 0.15);
}

body .wp-block-search__button,
.editor-styles-wrapper .wp-block-search__button {
    background-color: #5AB4E5;
    color: #FFFFFF;
    border: none;
    border-radius: 0 0.5rem 0.5rem 0;
    padding: 0.75rem 1.5rem;
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

body .wp-block-search__button:hover,
.editor-styles-wrapper .wp-block-search__button:hover {
    background-color: #3A9BD4;
}

/* ================================================================
   LATEST POSTS — Card-like styling
   ================================================================ */

body .wp-block-latest-posts,
.editor-styles-wrapper .wp-block-latest-posts {
    list-style: none;
    padding: 0;
    margin: 0;
}

body .wp-block-latest-posts__post-title,
.editor-styles-wrapper .wp-block-latest-posts__post-title {
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    font-size: 1rem;
    color: #222222;
    margin-bottom: 0.25rem;
}

body .wp-block-latest-posts__post-title a,
.editor-styles-wrapper .wp-block-latest-posts__post-title a {
    color: #222222;
    text-decoration: none;
}

body .wp-block-latest-posts__post-title a:hover,
.editor-styles-wrapper .wp-block-latest-posts__post-title a:hover {
    color: #5AB4E5;
}

body .wp-block-latest-posts__post-date,
.editor-styles-wrapper .wp-block-latest-posts__post-date {
    font-family: 'Montserrat', sans-serif;
    font-size: 0.8rem;
    color: #6B7280;
}

body .wp-block-latest-posts__post-excerpt,
.editor-styles-wrapper .wp-block-latest-posts__post-excerpt {
    font-family: 'Montserrat', sans-serif;
    font-size: 0.875rem;
    color: #4B5563;
    line-height: 1.6;
    margin-top: 0.25rem;
}

/* ================================================================
   EMBED — Consistent margin + border-radius
   ================================================================ */

body .wp-block-embed,
.editor-styles-wrapper .wp-block-embed {
    margin: 1.5rem 0;
    border-radius: 0.75rem;
    overflow: hidden;
}

/* ================================================================
   GALLERY — Gap + hover effect
   ================================================================ */

body .wp-block-gallery,
.editor-styles-wrapper .wp-block-gallery {
    margin: 1.5rem 0;
    gap: 0.5rem;
}

body .wp-block-gallery .blocks-gallery-item img,
.editor-styles-wrapper .wp-block-gallery .blocks-gallery-item img {
    border-radius: 0.5rem;
    transition: transform 0.2s ease;
}

body .wp-block-gallery .blocks-gallery-item img:hover,
.editor-styles-wrapper .wp-block-gallery .blocks-gallery-item img:hover {
    transform: scale(1.02);
}

/* ================================================================
   SPACER — Cap height
   ================================================================ */

body .wp-block-spacer,
.editor-styles-wrapper .wp-block-spacer {
    max-height: 120px;
}

/* ================================================================
   HTML / CUSTOM HTML — Monospace
   ================================================================ */

body .wp-block-html,
.editor-styles-wrapper .wp-block-html {
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.875rem;
    background-color: #F3F4F6;
    border: 1px dashed #D1D5DB;
    border-radius: 0.5rem;
    padding: 1rem;
    margin: 1rem 0;
    color: #6B7280;
}

/* ================================================================
   EDITOR-SPECIFIC OVERRIDES
   ================================================================ */

.editor-styles-wrapper {
    font-family: 'Montserrat', sans-serif;
    color: #222222;
    background-color: #FFFFFF;
}

.editor-styles-wrapper .is-root-container,
.block-editor-block-list__layout.is-root-container {
    max-width: 1280px;
    margin: 0 auto;
}

.editor-styles-wrapper a {
    text-decoration: underline;
    text-decoration-color: rgba(90, 180, 229, 0.3);
    text-underline-offset: 2px;
}

.editor-styles-wrapper a:hover {
    text-decoration-color: #5AB4E5;
}

.block-editor-block-list__block.is-selected::after,
.block-editor-block-list__block.is-hovered::after {
    border-color: #5AB4E5 !important;
}
