/**
 * Agentrix.com.br: global theme tokens (light default, dark via html[data-theme="dark"])
 */

html {
    color-scheme: light;

    /* Surfaces */
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --surface: #ffffff;
    --surface-elevated: #ffffff;
    --surface-hover: #f1f5f9;

    /* Text */
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;

    /* Borders & chrome */
    --border: #e2e8f0;
    --header-bg: linear-gradient(180deg, #1f2328 0%, #171b22 100%);
    --header-border: rgba(255, 255, 255, 0.08);
    --header-shadow: 0 4px 20px rgba(15, 23, 42, 0.14);
    --header-fg: #f8fafc;
    --header-fg-muted: #94a3b8;
    --header-fg-hover: #ffffff;
    --header-input-bg: rgba(255, 255, 255, 0.08);
    --header-input-border: rgba(255, 255, 255, 0.14);
    --header-input-fg: #f8fafc;
    --header-input-placeholder: #94a3b8;
    --header-control-bg: rgba(255, 255, 255, 0.06);
    --header-control-border: rgba(255, 255, 255, 0.12);
    --header-control-fg: #cbd5e1;
    --header-control-hover-bg: rgba(255, 255, 255, 0.12);
    --header-control-hover-fg: #f8fafc;
    --header-focus-ring: color-mix(in srgb, var(--accent) 55%, transparent);
    --header-cta-bg: #9de136;
    --header-cta-fg: #1f2328;
    --header-cta-hover-bg: #85c82e;
    --header-logo-mark-bg: #f8fafc;
    --header-logo-mark-fg: #1f2328;
    --header-logo-mark-sheen: rgba(157, 225, 54, 0.35);
    --header-logo-mark-grid: rgba(15, 23, 42, 0.12);
    --header-nav-active: var(--accent);
    --header-tagline-fg: var(--accent);

    /* Agentrix brand palette */
    --agentrix-primary: #9de136;
    --agentrix-primary-dark: #7bc022;
    --agentrix-primary-light: #eef9d9;
    --agentrix-navy: #0f172a;
    --agentrix-navy-soft: #1e293b;
    --agentrix-accent: #f97316;
    --agentrix-accent-light: #fed7aa;
    --agentrix-teal: #0e7490;

    /* Brand (lime green accent) */
    --accent: var(--agentrix-primary);
    --accent-strong: var(--agentrix-primary-dark);
    --accent-hover: var(--agentrix-primary-dark);
    --accent-soft: var(--agentrix-primary-light);
    --accent-link: var(--agentrix-primary);

    /* Icon badge pattern */
    --icon-badge-bg: var(--agentrix-primary-light);
    --icon-accent: #3d6210;
    --icon-badge-size: 2.75rem;
    --icon-badge-size-sm: 2.25rem;
    --icon-badge-size-lg: 3.5rem;
    --icon-badge-radius: var(--radius-md);
    --nav-hover: var(--header-fg-hover);

    /* Semantic UI (tabs, chips, nav pills, badges) */
    --nav-active-bg: #3a4629;
    --nav-active-fg: var(--header-nav-active);
    --nav-hover-bg: #2a2f36;
    --nav-hover-fg: var(--header-fg-hover);
    --tab-active-bg: var(--btn-primary-bg);
    --tab-active-fg: var(--btn-primary-fg);
    --tab-hover-bg: var(--surface-hover);
    --tab-hover-fg: var(--text-primary);
    --chip-active-bg: var(--tab-active-bg);
    --chip-active-fg: var(--tab-active-fg);
    --chip-hover-bg: var(--tab-hover-bg);
    --chip-hover-fg: var(--tab-hover-fg);
    --badge-bg: var(--layout-badge-bg, var(--agentrix-primary));
    --badge-fg: var(--layout-badge-fg, var(--btn-primary-fg));
    --btn-secondary-bg: var(--surface);
    --btn-secondary-fg: var(--text-primary);
    --btn-secondary-hover-bg: var(--surface-hover);

    /* Buttons */
    --btn-primary-bg: var(--agentrix-primary);
    --btn-primary-fg: #1f2328;
    --btn-primary-hover-bg: var(--agentrix-primary-dark);

    /* Forms */
    --input-bg: var(--bg-secondary);
    --input-fg: var(--text-primary);
    --input-border: var(--border);
    --input-placeholder: var(--text-muted);
    --focus-ring: color-mix(in srgb, var(--accent) 40%, transparent);

    /* Newsletter band */
    --newsletter-bg: #1f2328;
    --newsletter-fg: #f8fafc;
    --newsletter-muted: #cbd5e1;
    --newsletter-input-bg: #0f172a;
    --newsletter-input-border: rgba(255, 255, 255, 0.12);
    --newsletter-btn-bg: var(--agentrix-primary);
    --newsletter-btn-hover: var(--agentrix-primary-dark);
    --newsletter-link: var(--agentrix-primary);

    /* Editorial badges (layout override via --layout-badge-*) */
    --layout-badge-bg: var(--agentrix-primary);
    --layout-badge-fg: #111827;

    /* Category ribbons on public listing cards */
    --category-ribbon-bg: #9de136;
    --category-ribbon-fg: #111827;

    /* Article prose */
    --prose-fg: var(--text-primary);
    --prose-heading: var(--text-primary);
    --prose-muted: var(--text-secondary);
    --prose-link: var(--accent-link);
    --prose-link-hover: var(--accent-hover);
    --prose-code-bg: var(--bg-secondary);
    --prose-code-fg: var(--text-primary);
    --prose-pre-bg: #0f172a;
    --prose-pre-fg: #e2e8f0;
    --prose-blockquote-border: var(--accent);
    --prose-blockquote-bg: var(--bg-secondary);

    /* Illustrations */
    --illus-1-start: #f4fce8;
    --illus-1-end: #e8f5c9;
    --illus-2-start: #f0fdf4;
    --illus-2-end: #dcfce7;
    --illus-3-start: #f7fee7;
    --illus-3-end: #ecfccb;

    /* Feedback */
    --danger: #cf222e;
    --danger-bg: #ffebe9;
    --danger-border: color-mix(in srgb, var(--danger) 40%, transparent);
    --success: #16a34a;
    --success-bg: #dcfce7;
    --success-border: color-mix(in srgb, var(--success) 40%, transparent);

    /* Logo mark */
    --logo-mark-bg: #1f2328;
    --logo-mark-fg: #f8fafc;
    --logo-mark-sheen: rgba(255, 255, 255, 0.14);
    --logo-mark-grid: rgba(255, 255, 255, 0.08);

    /* Footer */
    --footer-logo-mark-size: 52px;
    --footer-main-bg: #eef2f7;
    --footer-main-border: #d8dee7;
    --footer-main-text: #1f2937;
    --footer-main-text-secondary: #475569;
    --footer-main-link: #334155;
    --footer-main-link-hover: var(--accent);
    --footer-bar-bg: #dfe6ee;
    --footer-bar-border: #cbd5e1;
    --footer-bar-text: #475569;

    /* Agentrix Play band */
    --agentrix-play-bg: var(--footer-main-bg);
    --agentrix-play-border: var(--footer-main-border);
    --agentrix-play-text: var(--footer-main-text);
    --agentrix-play-text-secondary: var(--footer-main-text-secondary);
    --agentrix-play-card-bg: var(--surface);
    --agentrix-play-card-border: var(--border);

    /* Publicidade band */
    --ad-section-bg: #e4e9f0;
    --ad-section-border: #cdd5df;
    --ad-section-text: var(--footer-main-text);
    --ad-section-text-secondary: var(--footer-main-text-secondary);
    --ad-slot-bg: color-mix(in srgb, var(--surface) 88%, var(--ad-section-bg));
    --ad-slot-border: var(--border);
    --ad-slot-frame-bg: var(--surface);
    --ad-slot-label: var(--text-muted);
    --ad-slot-min-h: 8.5rem;
    --ad-top-banner-min-h: 5.625rem;
    --ad-top-banner-min-h-mobile: 3.75rem;
    --ad-placement-spacing-after: var(--space-5);

    /* Featured highlight */
    --featured-layout-gap: var(--space-4);
    --featured-carousel-aspect: 16 / 9;
    --featured-side-aspect: 4 / 3;
    --featured-carousel-min-h: 16rem;
    --featured-media-radius: var(--radius-xl);
    --featured-overlay: linear-gradient(
        180deg,
        rgba(15, 23, 42, 0.12) 0%,
        rgba(15, 23, 42, 0.55) 42%,
        rgba(15, 23, 42, 0.82) 72%,
        rgba(15, 23, 42, 0.94) 100%
    );
    --featured-overlay-text: #f8fafc;
    --featured-card-border: var(--border);
    --featured-card-shadow: var(--shadow-md);

    /* Mobile navigation */
    --mobile-nav-bg: var(--surface);
    --mobile-nav-overlay: rgba(15, 23, 42, 0.45);
    --mobile-nav-shadow: -8px 0 32px rgba(15, 23, 42, 0.12);
    --mobile-nav-width: min(20rem, 88vw);

    /* Shadows */
    --shadow-sm: 0 4px 12px rgba(15, 23, 42, 0.05);
    --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.06);
    --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.1);
    --shadow-card-hover: 0 12px 32px rgba(15, 23, 42, 0.12);

    /* Typography */
    --font-sans: Inter, "Segoe UI", Roboto, Arial, sans-serif;
    --font-size-xs: 0.72rem;
    --font-size-sm: 0.86rem;
    --font-size-base: 1rem;
    --font-size-lg: 1.15rem;
    --font-size-xl: clamp(1.5rem, 3vw, 2rem);
    --font-size-hero: clamp(2rem, 5vw, 3.35rem);
    --line-height-tight: 1.15;
    --line-height-base: 1.55;
    --line-height-subtitle: 1.5;

    /* Section intros (homepage) */
    --section-intro-eyebrow-gap: var(--space-3);
    --section-intro-title-gap: var(--space-3);
    --section-intro-content-gap: var(--space-8);
    --section-subtitle-size: 1.0625rem;
    --section-subtitle-color: var(--text-secondary);
    --section-subtitle-color-on-dark: var(--agentrix-play-text-secondary);
    --section-subtitle-color-on-ad: var(--ad-section-text-secondary);

    /* Spacing */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;
    --space-10: 40px;
    --space-12: 48px;

    /* Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 14px;
    --radius-xl: 18px;
    --radius-pill: 999px;

    /* Icon sizes */
    --icon-xs: 16px;
    --icon-sm: 18px;
    --icon-md: 20px;
    --icon-lg: 24px;
    --icon-xl: 32px;

    /* Layout */
    --container-max: 1140px;
    --header-height: 72px;
    --logo-mark-size: 44px;

    /* Admin shell */
    --admin-shell-bg: var(--bg-secondary);
    --admin-content-width: 98%;
    --admin-content-max: 1680px;
    --admin-topbar-bg: var(--header-bg);
    --admin-topbar-border: var(--header-border);
    --admin-topbar-shadow: var(--header-shadow);
    --admin-topbar-fg: var(--header-fg);
    --admin-topbar-fg-muted: var(--header-fg-muted);
    --admin-topbar-link: var(--header-fg-muted);
    --admin-topbar-link-hover: var(--nav-hover-fg);
    --admin-topbar-link-active-bg: var(--nav-active-bg);
    --admin-topbar-link-active-fg: var(--nav-active-fg);
    --admin-footer-bg: var(--footer-bar-bg);
    --admin-footer-border: var(--footer-bar-border);
    --admin-footer-fg: var(--footer-bar-text);
    --admin-panel-shadow: var(--shadow-sm);
    --admin-table-head-bg: color-mix(in srgb, var(--bg-secondary) 65%, var(--surface));

    /* Legacy aliases (redefined per theme) */
    --color-bg: var(--bg-primary);
    --color-bg-soft: var(--bg-secondary);
    --color-card: var(--surface);
    --color-text: var(--text-primary);
    --color-text-soft: var(--text-secondary);
    --color-border: var(--border);
    --color-accent: var(--accent);
    --color-accent-soft: var(--accent-soft);
    --color-accent-link: var(--accent-link);
    --color-button: var(--btn-primary-bg);
    --color-button-text: var(--btn-primary-fg);
    --color-danger: var(--danger);
    --color-success: var(--success);
    --color-icon: currentColor;
    --bg: var(--bg-primary);
    --bg-soft: var(--bg-secondary);
    --card-bg: var(--surface);
    --text: var(--text-primary);
    --text-soft: var(--text-secondary);
    --border-color: var(--border);
    --accent-color: var(--accent);
    --accent-soft-color: var(--accent-soft);
    --button-dark: var(--btn-primary-bg);
    --shadow: var(--shadow-md);
    --radius: var(--radius-lg);
    --header-h: var(--header-height);
}

html[data-theme="dark"] {
    color-scheme: dark;

    --bg-primary: #0b1220;
    --bg-secondary: #111827;
    --surface: #151f2e;
    --surface-elevated: #1f2937;
    --surface-hover: #1f2937;

    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;

    --border: rgba(255, 255, 255, 0.1);
    --header-bg: linear-gradient(180deg, #070d18 0%, #0f172a 100%);
    --header-border: rgba(255, 255, 255, 0.06);
    --header-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
    --header-fg: #f8fafc;
    --header-fg-muted: #94a3b8;
    --header-fg-hover: #ffffff;
    --header-input-bg: rgba(255, 255, 255, 0.06);
    --header-input-border: rgba(255, 255, 255, 0.1);
    --header-input-fg: #f8fafc;
    --header-input-placeholder: #64748b;
    --header-control-bg: rgba(255, 255, 255, 0.05);
    --header-control-border: rgba(255, 255, 255, 0.1);
    --header-control-fg: #cbd5e1;
    --header-control-hover-bg: rgba(255, 255, 255, 0.1);
    --header-control-hover-fg: #f8fafc;
    --header-focus-ring: color-mix(in srgb, var(--accent-link) 50%, transparent);
    --header-cta-bg: #9de136;
    --header-cta-fg: #0b1220;
    --header-cta-hover-bg: #b5eb5a;
    --header-logo-mark-bg: #e6edf3;
    --header-logo-mark-fg: #0b1220;
    --header-logo-mark-sheen: rgba(157, 225, 54, 0.4);
    --header-logo-mark-grid: rgba(157, 225, 54, 0.15);
    --header-nav-active: var(--accent);
    --header-tagline-fg: var(--accent);

    --agentrix-primary: #9de136;
    --agentrix-primary-dark: #85c82e;
    --agentrix-primary-light: #1a2f14;
    --agentrix-navy: #0f172a;
    --agentrix-navy-soft: #1e293b;
    --agentrix-accent: #fb923c;
    --agentrix-accent-light: #431407;
    --agentrix-teal: #0891b2;

    --accent: var(--agentrix-primary);
    --accent-strong: #b5eb5a;
    --accent-hover: #c8f07a;
    --accent-soft: var(--agentrix-primary-light);
    --accent-link: var(--agentrix-primary);

    --icon-badge-bg: color-mix(in srgb, var(--agentrix-primary) 14%, #0b1220);
    --icon-accent: var(--accent-strong);
    --nav-hover: var(--header-fg-hover);
    --nav-active-bg: #3a4629;
    --nav-active-fg: var(--header-nav-active);
    --nav-hover-bg: #2a2f36;
    --nav-hover-fg: var(--header-fg-hover);
    --tab-active-bg: var(--btn-primary-bg);
    --tab-active-fg: var(--btn-primary-fg);
    --tab-hover-bg: var(--surface-hover);
    --tab-hover-fg: var(--text-primary);
    --chip-active-bg: var(--tab-active-bg);
    --chip-active-fg: var(--tab-active-fg);
    --chip-hover-bg: var(--tab-hover-bg);
    --chip-hover-fg: var(--tab-hover-fg);
    --badge-bg: var(--layout-badge-bg, var(--agentrix-primary));
    --badge-fg: var(--layout-badge-fg, var(--btn-primary-fg));
    --layout-badge-bg: var(--agentrix-primary);
    --layout-badge-fg: #111827;
    --category-ribbon-bg: #9de136;
    --category-ribbon-fg: #111827;
    --btn-secondary-bg: var(--surface);
    --btn-secondary-fg: var(--text-primary);
    --btn-secondary-hover-bg: var(--surface-hover);

    --btn-primary-bg: var(--agentrix-primary);
    --btn-primary-fg: #0b1220;
    --btn-primary-hover-bg: var(--agentrix-primary-dark);

    --input-bg: var(--surface);
    --input-fg: var(--text-primary);
    --input-border: var(--border);
    --input-placeholder: var(--text-muted);
    --focus-ring: color-mix(in srgb, var(--accent-link) 45%, transparent);

    --newsletter-bg: #151f2e;
    --newsletter-fg: #f8fafc;
    --newsletter-muted: #94a3b8;
    --newsletter-input-bg: #0b1220;
    --newsletter-input-border: rgba(255, 255, 255, 0.1);
    --newsletter-btn-bg: var(--agentrix-primary-dark);
    --newsletter-btn-hover: var(--agentrix-primary);
    --newsletter-link: var(--agentrix-primary);

    --prose-fg: var(--text-primary);
    --prose-heading: var(--text-primary);
    --prose-muted: var(--text-secondary);
    --prose-link: var(--accent-link);
    --prose-link-hover: var(--accent-hover);
    --prose-code-bg: var(--surface-elevated);
    --prose-code-fg: var(--text-primary);
    --prose-pre-bg: #0b1220;
    --prose-pre-fg: #e2e8f0;
    --prose-blockquote-border: var(--accent-strong);
    --prose-blockquote-bg: var(--surface);

    --illus-1-start: #1c2a3a;
    --illus-1-end: #1a2f28;
    --illus-2-start: #1c2a3a;
    --illus-2-end: #1a2f28;
    --illus-3-start: #1c2a3a;
    --illus-3-end: #1a2f28;

    --danger: #ff7b72;
    --danger-bg: #3d1418;
    --danger-border: color-mix(in srgb, var(--danger) 35%, transparent);
    --success: #22c55e;
    --success-bg: #14291f;
    --success-border: color-mix(in srgb, var(--success) 35%, transparent);

    --logo-mark-bg: #e6edf3;
    --logo-mark-fg: #0b1220;
    --logo-mark-sheen: rgba(157, 225, 54, 0.35);
    --logo-mark-grid: rgba(157, 225, 54, 0.15);

    --footer-main-bg: #111827;
    --footer-main-border: rgba(255, 255, 255, 0.08);
    --footer-main-text: var(--text-primary);
    --footer-main-text-secondary: var(--text-secondary);
    --footer-main-link: var(--text-secondary);
    --footer-main-link-hover: var(--accent);
    --footer-bar-bg: #0b1220;
    --footer-bar-border: rgba(255, 255, 255, 0.06);
    --footer-bar-text: var(--text-muted);

    --agentrix-play-bg: var(--footer-main-bg);
    --agentrix-play-border: var(--footer-main-border);
    --agentrix-play-text: var(--footer-main-text);
    --agentrix-play-text-secondary: var(--footer-main-text-secondary);
    --agentrix-play-card-bg: var(--surface);
    --agentrix-play-card-border: var(--border);

    --ad-section-bg: #141c2b;
    --ad-section-border: rgba(255, 255, 255, 0.08);
    --ad-section-text: var(--text-primary);
    --ad-section-text-secondary: var(--text-secondary);
    --ad-slot-bg: color-mix(in srgb, var(--surface) 70%, var(--ad-section-bg));
    --ad-slot-border: var(--border);
    --ad-slot-frame-bg: var(--bg-secondary);
    --ad-slot-label: var(--text-muted);

    --featured-overlay: linear-gradient(
        180deg,
        rgba(2, 6, 23, 0.18) 0%,
        rgba(2, 6, 23, 0.58) 42%,
        rgba(2, 6, 23, 0.84) 72%,
        rgba(2, 6, 23, 0.96) 100%
    );
    --featured-layout-gap: var(--space-4);
    --featured-overlay-text: #f8fafc;
    --featured-card-border: var(--border);
    --featured-card-shadow: var(--shadow-md);

    --mobile-nav-bg: var(--surface);
    --mobile-nav-overlay: rgba(0, 0, 0, 0.55);
    --mobile-nav-shadow: -8px 0 40px rgba(0, 0, 0, 0.45);

    --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.25);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.45);
    --shadow-card-hover: 0 12px 32px rgba(0, 0, 0, 0.4);

    --color-bg: var(--bg-primary);
    --color-bg-soft: var(--bg-secondary);
    --color-card: var(--surface);
    --color-text: var(--text-primary);
    --color-text-soft: var(--text-secondary);
    --color-border: var(--border);
    --color-accent: var(--accent);
    --color-accent-soft: var(--accent-soft);
    --color-accent-link: var(--accent-link);
    --color-button: var(--btn-primary-bg);
    --color-button-text: var(--btn-primary-fg);
    --color-danger: var(--danger);
    --color-success: var(--success);
    --bg: var(--bg-primary);
    --bg-soft: var(--bg-secondary);
    --card-bg: var(--surface);
    --text: var(--text-primary);
    --text-soft: var(--text-secondary);
    --border-color: var(--border);
    --accent-color: var(--accent);
    --accent-soft-color: var(--accent-soft);
    --button-dark: var(--btn-primary-bg);
    --shadow: var(--shadow-md);
}

@media (max-width: 767px) {
    html {
        --logo-mark-size: 40px;
    }
}
