/**
 * Agentic — Core Block Styles (blocks.css)
 *
 * Makes Gutenberg core blocks inherit the theme's dark design system.
 * Loaded globally, after style.css, so DB-authored block content renders
 * with the same tokens, surfaces, and gradient language as the templates.
 *
 * Token reference: see style.css :root (--agentic-*).
 *
 * @since 1.0.0
 */

/* ---------------------------------------------------------------------------
 * Buttons — the signature gradient, mapped from fp-btn (critical.css).
 * Gradient starts at primary-dark (#9333ea) so white text passes AA (5.4:1).
 * ------------------------------------------------------------------------ */
.wp-block-button__link,
.wp-block-file .wp-block-file__button,
.wp-block-search .wp-block-search__button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.85rem 1.75rem;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--agentic-primary-dark) 0%, var(--agentic-secondary) 100%);
    color: var(--agentic-text-inverse);
    font-weight: 600;
    font-size: 1rem;
    line-height: 1.2;
    text-decoration: none;
    box-shadow: 0 8px 30px rgba(168, 85, 247, 0.25);
    transition: transform 0.25s ease, box-shadow 0.25s ease, filter 0.25s ease;
}

.wp-block-button__link:hover,
.wp-block-button__link:focus-visible,
.wp-block-file .wp-block-file__button:hover,
.wp-block-search .wp-block-search__button:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 40px rgba(168, 85, 247, 0.4);
    filter: brightness(1.1);
    color: var(--agentic-text-inverse);
}

.wp-block-button__link:active {
    transform: translateY(0);
}

/* Outline style — mirrors fp-btn--secondary. */
.wp-block-button.is-style-outline .wp-block-button__link,
.wp-block-button__link.is-style-outline {
    background: rgba(255, 255, 255, 0.08);
    border: 2px solid rgba(255, 255, 255, 0.2);
    box-shadow: none;
    color: var(--agentic-text-primary);
}

.wp-block-button.is-style-outline .wp-block-button__link:hover {
    background: rgba(255, 255, 255, 0.14);
    border-color: rgba(255, 255, 255, 0.35);
    filter: none;
}

/* Buttons width modifiers from core. */
.wp-block-button.aligncenter {
    text-align: center;
}

/* ---------------------------------------------------------------------------
 * Typography helpers
 * ------------------------------------------------------------------------ */
.has-drop-cap:not(:focus)::first-letter {
    color: var(--agentic-primary);
    font-weight: 700;
}

/* ---------------------------------------------------------------------------
 * Quotes & pullquotes — accent-bar language.
 * ------------------------------------------------------------------------ */
.wp-block-quote {
    margin: var(--agentic-spacing-xl) 0;
    padding: var(--agentic-spacing-md) var(--agentic-spacing-lg);
    border-left: 4px solid;
    border-image: linear-gradient(180deg, var(--agentic-primary), var(--agentic-secondary)) 1;
    background: rgba(168, 85, 247, 0.06);
    border-radius: 0 var(--agentic-border-radius) var(--agentic-border-radius) 0;
}

.wp-block-quote p {
    margin-bottom: var(--agentic-spacing-sm);
    font-size: 1.1rem;
    color: var(--agentic-text-primary);
}

.wp-block-quote cite,
.wp-block-quote footer {
    font-size: 0.875rem;
    color: var(--agentic-text-secondary);
    font-style: normal;
}

.wp-block-quote.is-style-large,
.wp-block-quote.is-style-plain {
    background: transparent;
    border-image: none;
    border-left-color: var(--agentic-primary);
}

.wp-block-pullquote {
    margin: var(--agentic-spacing-2xl) 0;
    padding: var(--agentic-spacing-xl) 0;
    border-top: 1px solid var(--agentic-border-color);
    border-bottom: 1px solid var(--agentic-border-color);
    text-align: center;
}

.wp-block-pullquote blockquote {
    margin: 0;
}

.wp-block-pullquote p {
    font-size: 1.5rem;
    font-weight: 600;
    line-height: 1.35;
    background: linear-gradient(135deg, var(--agentic-primary) 0%, var(--agentic-accent) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.wp-block-pullquote cite {
    display: inline-block;
    margin-top: var(--agentic-spacing-md);
    font-size: 0.875rem;
    color: var(--agentic-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-style: normal;
}

.wp-block-pullquote.is-style-solid-color blockquote {
    background: var(--agentic-surface);
    border-radius: 12px;
    padding: var(--agentic-spacing-xl);
    max-width: 720px;
    margin: 0 auto;
}

/* ---------------------------------------------------------------------------
 * Tables — dark-native surface treatment.
 * ------------------------------------------------------------------------ */
.wp-block-table {
    margin: var(--agentic-spacing-xl) 0;
}

.wp-block-table table {
    width: 100%;
    border-collapse: collapse;
    background: var(--agentic-surface);
    border: 1px solid var(--agentic-border-color);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: var(--agentic-shadow-md);
}

.wp-block-table th,
.wp-block-table td {
    padding: 0.85rem 1.1rem;
    border: 1px solid var(--agentic-border-color);
    color: var(--agentic-text-primary);
    font-size: 0.95rem;
    text-align: left;
}

.wp-block-table thead {
    border-bottom: 2px solid var(--agentic-primary);
}

.wp-block-table thead th {
    background: var(--agentic-surface-elevated);
    font-weight: 700;
    letter-spacing: 0.02em;
}

.wp-block-table tfoot td {
    background: rgba(255, 255, 255, 0.03);
    font-weight: 600;
}

/* Stripes style — the core default is blinding light gray on dark themes. */
.wp-block-table.is-style-stripes tbody tr:nth-child(odd),
.wp-block-table .is-style-stripes tbody tr:nth-child(odd) {
    background-color: rgba(255, 255, 255, 0.04);
}

.wp-block-table.is-style-stripes th,
.wp-block-table.is-style-stripes td {
    border-color: var(--agentic-border-color);
}

.wp-block-table figcaption {
    margin-top: var(--agentic-spacing-sm);
}

/* ---------------------------------------------------------------------------
 * Code & preformatted
 * ------------------------------------------------------------------------ */
.wp-block-code,
.wp-block-preformatted {
    background: var(--agentic-surface-elevated);
    border: 1px solid var(--agentic-border-color);
    border-radius: 10px;
    padding: var(--agentic-spacing-lg);
    overflow-x: auto;
    box-shadow: var(--agentic-shadow-sm);
}

.wp-block-code code,
.wp-block-preformatted {
    color: #c4b5fd; /* softened violet — readable on elevated surface */
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 0.9rem;
    line-height: 1.6;
}

p code, li code, td code {
    background: rgba(168, 85, 247, 0.12);
    border: 1px solid rgba(168, 85, 247, 0.2);
    border-radius: 4px;
    padding: 0.1em 0.4em;
    font-size: 0.875em;
    color: #d8b4fe;
}

/* Verse */
.wp-block-verse {
    font-family: inherit;
    color: var(--agentic-text-secondary);
}

/* ---------------------------------------------------------------------------
 * Separator — gradient hairline instead of invisible gray.
 * ------------------------------------------------------------------------ */
.wp-block-separator {
    border: none;
    height: 1px;
    margin: var(--agentic-spacing-2xl) auto;
    background: linear-gradient(90deg, transparent, var(--agentic-primary) 30%, var(--agentic-secondary) 70%, transparent);
    opacity: 0.6;
    width: 100%;
    max-width: 480px;
}

.wp-block-separator.is-style-wide {
    max-width: 1200px;
}

.wp-block-separator.is-style-dots {
    background: none;
    height: auto;
    color: var(--agentic-primary);
    font-size: 1.5rem;
}

.wp-block-separator.is-style-dots::before {
    color: var(--agentic-primary);
}

/* ---------------------------------------------------------------------------
 * Images, galleries, captions
 * ------------------------------------------------------------------------ */
.wp-block-image {
    margin: var(--agentic-spacing-xl) 0;
}

.wp-block-image img {
    border-radius: 10px;
}

.wp-block-image figcaption,
.wp-block-gallery figcaption,
.wp-block-embed figcaption,
.wp-block-table figcaption,
.wp-block-video figcaption,
.wp-block-audio figcaption {
    margin-top: var(--agentic-spacing-sm);
    font-size: 0.85rem;
    color: var(--agentic-text-secondary);
    text-align: center;
    font-style: italic;
}

.wp-block-image .aligncenter > figcaption,
.wp-block-image .alignleft > figcaption,
.wp-block-image .alignright > figcaption {
    display: block;
}

.wp-block-gallery .blocks-gallery-item figcaption {
    background: linear-gradient(0deg, rgba(13, 13, 26, 0.85), transparent);
    color: var(--agentic-text-primary);
    font-style: normal;
    padding: 2rem 1rem 0.75rem;
}

/* ---------------------------------------------------------------------------
 * Cover — readable overlays by default.
 * ------------------------------------------------------------------------ */
.wp-block-cover,
.wp-block-cover-image {
    border-radius: 12px;
    overflow: hidden;
    padding: var(--agentic-spacing-xl);
}

.wp-block-cover .wp-block-cover__inner-container {
    color: var(--agentic-text-inverse);
}

.wp-block-cover .wp-block-cover__inner-container p {
    line-height: 1.4;
}

.wp-block-cover.has-background-dim:not(.has-background-gradient)::before {
    background-color: rgba(13, 13, 26, 0.55);
}

/* ---------------------------------------------------------------------------
 * Groups, columns, media-text — cards and layout.
 * ------------------------------------------------------------------------ */
.wp-block-group.has-background,
.wp-block-group.is-style-card {
    padding: var(--agentic-spacing-xl);
    border-radius: 12px;
    border: 1px solid var(--agentic-border-color);
}

.wp-block-group.has-background:not(.has-background-color) {
    background: var(--agentic-surface);
}

.wp-block-columns {
    gap: var(--agentic-spacing-lg);
    margin: var(--agentic-spacing-xl) 0;
}

.wp-block-media-text {
    background: var(--agentic-surface);
    border-radius: 12px;
    overflow: hidden;
}

.wp-block-media-text .wp-block-media-text__content {
    padding: var(--agentic-spacing-xl);
}

/* ---------------------------------------------------------------------------
 * Alignment widths — theme declares align-wide support; give it real widths.
 * ------------------------------------------------------------------------ */
.alignwide {
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
}

.alignfull {
    width: 100vw;
    max-width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
}

/* ---------------------------------------------------------------------------
 * Lists & query loops
 * ------------------------------------------------------------------------ */
.wp-block-latest-posts,
.wp-block-categories,
.wp-block-archives {
    padding-left: 1.2em;
    color: var(--agentic-text-primary);
}

.wp-block-latest-posts li,
.wp-block-categories li,
.wp-block-archives li {
    margin-bottom: var(--agentic-spacing-sm);
}

.wp-block-latest-posts li a,
.wp-block-categories a,
.wp-block-archives a {
    color: var(--agentic-text-primary);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: color 0.15s ease, border-color 0.15s ease;
}

.wp-block-latest-posts li a:hover,
.wp-block-categories a:hover,
.wp-block-archives a:hover {
    color: var(--agentic-accent);
    border-bottom-color: var(--agentic-accent);
}

.wp-block-latest-posts.is-grid {
    display: grid;
    gap: var(--agentic-spacing-lg);
    padding-left: 0;
    list-style: none;
}

.wp-block-latest-posts.is-grid li {
    background: var(--agentic-surface);
    border: 1px solid var(--agentic-border-color);
    border-radius: 12px;
    padding: var(--agentic-spacing-lg);
    margin-bottom: 0;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.wp-block-latest-posts.is-grid li:hover {
    transform: translateY(-2px);
    box-shadow: var(--agentic-shadow-md);
}

/* ---------------------------------------------------------------------------
 * Search, file, social, embeds
 * ------------------------------------------------------------------------ */
.wp-block-search .wp-block-search__input {
    background: var(--agentic-surface);
    border: 1px solid var(--agentic-border-color);
    border-radius: 10px;
    color: var(--agentic-text-primary);
    padding: 0.75rem 1rem;
}

.wp-block-search .wp-block-search__input::placeholder {
    color: var(--agentic-text-secondary);
}

.wp-block-search .wp-block-search__input:focus {
    border-color: var(--agentic-primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.25);
}

.wp-block-file {
    display: flex;
    align-items: center;
    gap: var(--agentic-spacing-md);
    background: var(--agentic-surface);
    border: 1px solid var(--agentic-border-color);
    border-radius: 10px;
    padding: var(--agentic-spacing-md) var(--agentic-spacing-lg);
}

.wp-block-file a:not(.wp-block-file__button) {
    color: var(--agentic-text-primary);
    text-decoration: none;
    font-weight: 500;
}

.wp-block-social-links .wp-social-link a {
    transition: transform 0.15s ease, opacity 0.15s ease;
}

.wp-block-social-links .wp-social-link a:hover {
    transform: translateY(-2px);
    opacity: 0.85;
}

.wp-block-embed {
    margin: var(--agentic-spacing-xl) 0;
}

.wp-block-embed .wp-block-embed__wrapper {
    border-radius: 12px;
    overflow: hidden;
}

/* ---------------------------------------------------------------------------
 * Author-picked colors (.has-*) — no palette is registered, so guard the
 * container behavior only: padded, rounded surfaces instead of raw color dumps.
 * ------------------------------------------------------------------------ */
.has-background {
    padding: var(--agentic-spacing-lg);
    border-radius: 10px;
}

/* ---------------------------------------------------------------------------
 * Motion safety
 * ------------------------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
    .wp-block-button__link,
    .wp-block-latest-posts.is-grid li,
    .wp-block-social-links .wp-social-link a {
        transition: none;
    }

    .wp-block-button__link:hover,
    .wp-block-latest-posts.is-grid li:hover,
    .wp-block-social-links .wp-social-link a:hover {
        transform: none;
    }
}

/* ---------------------------------------------------------------------------
 * Small screens
 * ------------------------------------------------------------------------ */
@media (max-width: 768px) {
    .wp-block-button__link {
        padding: 0.75rem 1.4rem;
        font-size: 0.95rem;
    }

    .wp-block-pullquote p {
        font-size: 1.2rem;
    }

    .wp-block-group.has-background,
    .wp-block-media-text .wp-block-media-text__content {
        padding: var(--agentic-spacing-lg);
    }
}
