/**
 * IT Ecosystem — Newspaper theme companion stylesheet
 *
 * Loaded INSTEAD of frontend.css when the Newspaper theme is active.
 * The theme-agnostic frontend.css aggressively rewrites typography,
 * background, width and padding (with lots of !important). Inside
 * Newspaper that fight produces a "stuck-on" feel: full-bleed white
 * dashboards landing on a magazine layout.
 *
 * This stylesheet does the opposite: yields to the theme for chrome
 * (font, color, container width) and only ships the bits the theme
 * cannot provide — grid layouts for cards, dashboard stats, badges.
 */

/* ===== Theme-derived design tokens ============================
 * Newspaper exposes its palette and typography via CSS custom
 * properties set on :root. We map our plugin variables onto them
 * with safe fallbacks for older theme versions.
 * ============================================================ */

body.ecosystem-page.theme-newspaper {
    --eco-font: inherit;

    --eco-primary:        var(--td-color-primary,    #d9534f);
    --eco-primary-dark:   var(--td-color-primary-h,  #b13d3a);
    --eco-primary-light:  var(--td-color-primary-l,  #fde9e8);
    --eco-secondary:      var(--td-color-secondary,  #222);
    --eco-secondary-light:#f5f5f5;
    --eco-accent:         var(--td-color-primary,    #d9534f);
    --eco-accent-light:   #fde9e8;

    --eco-gray-50:  #fafafa;
    --eco-gray-100: #f5f5f5;
    --eco-gray-200: #ececec;
    --eco-gray-300: #dcdcdc;
    --eco-gray-400: #b4b4b4;
    --eco-gray-500: #777;
    --eco-gray-600: #555;
    --eco-gray-700: #333;
    --eco-gray-800: #222;
    --eco-gray-900: #111;

    /* Newspaper is a strictly square theme (modules, inputs, buttons all
     * have 0 corner radius), so we drop the plugin's rounding to match. */
    --eco-radius:    0;
    --eco-radius-sm: 0;
    --eco-shadow:    0 1px 2px rgba(0,0,0,0.06);
    --eco-shadow-md: 0 2px 6px rgba(0,0,0,0.08);
    --eco-shadow-lg: 0 6px 18px rgba(0,0,0,0.10);
}

/* ===== Reset the theme-agnostic over-overrides =================
 * frontend.css forces background/width/!important. Since this file
 * loads INSTEAD of frontend.css under Newspaper, those rules are
 * already absent — but we keep this section explicit so a future
 * dual-load (theme switch without page reload) stays sane.
 * ============================================================ */

body.ecosystem-page.theme-newspaper .eco-wrap,
body.ecosystem-page.theme-newspaper .eco-landing-wrap,
body.ecosystem-page.theme-newspaper .eco-graph-fullscreen {
    width: auto;
    max-width: none;       /* td-container above us already sets 1140px */
    margin: 0;
    padding: 0;
    background: transparent;
    color: inherit;
    font-family: inherit;
    line-height: inherit;
}

body.ecosystem-page.theme-newspaper .eco-wrap *,
body.ecosystem-page.theme-newspaper .eco-landing-wrap *,
body.ecosystem-page.theme-newspaper .eco-graph-fullscreen * {
    font-family: inherit;
    box-sizing: border-box;
}

/* ===== Breadcrumbs ===========================================
 * render_breadcrumbs() emits markup identical to Newspaper's own
 * tdb_breadcrumbs block. The principle here is INHERITANCE: don't
 * hard-code Newspaper's color/font/size values — they belong to the
 * theme. If Newspaper updates them, we follow automatically.
 *
 * Rules we DO ship:
 *   - Structural: line-height, separator size/margin (not inherited)
 *   - Tiny font-size hint (12px) for the crumbs row, with var() fallback
 * Rules we DO NOT ship:
 *   - font-family — naturally inherits from theme's body
 *   - color — inherits, plus dark-hero overrides below where needed
 * ============================================================ */
body.theme-newspaper .tdb-breadcrumbs {
    margin-bottom: 11px;
    font-size: var(--tdb-breadcrumbs-font-size, 12px);
    line-height: 1.5;
}
body.theme-newspaper .tdb-breadcrumbs a,
body.theme-newspaper .tdb-breadcrumbs .tdb-entry-crumb {
    color: inherit;
    text-decoration: none;
    transition: opacity 120ms ease;
}
body.theme-newspaper .tdb-breadcrumbs a:hover,
body.theme-newspaper .tdb-breadcrumbs .tdb-entry-crumb:hover {
    opacity: 0.65;
}
body.theme-newspaper .tdb-breadcrumbs .tdb-bread-sep {
    font-size: 8px;
    margin: 0 5px;
    line-height: 1;
    vertical-align: middle;
    opacity: 0.5;
}

/* All plugin heroes (single vendor/company/product, archives, taxonomy,
 * landing) now render light/white to match Newspaper's content area, so the
 * breadcrumbs simply inherit the theme's dark crumb color set above — no
 * per-hero white inversion is needed. */

/* Old plugin-rendered .eco-breadcrumbs (used on non-Newspaper themes
 * or as a fallback) gets only a light reset here — base frontend.css
 * still owns its visual treatment. */
body.theme-newspaper nav.eco-breadcrumbs:not(.eco-breadcrumbs-np) {
    font-family: inherit;
}

/* ===== Headings ============================================== */
body.theme-newspaper .eco-wrap h1,
body.theme-newspaper .eco-wrap .eco-hero-title { font-size: 32px; line-height: 1.15; margin: 0 0 16px; font-weight: 700; }
body.theme-newspaper .eco-wrap h2 { font-size: 22px; line-height: 1.25; margin: 28px 0 14px; font-weight: 700; }
body.theme-newspaper .eco-wrap h3 { font-size: 17px; line-height: 1.3;  margin: 20px 0 10px; font-weight: 700; }
body.theme-newspaper .eco-wrap h4 { font-size: 15px; line-height: 1.3;  margin: 16px 0 8px;  font-weight: 700; }

/* ===== Hero / page header ====================================
 * Base frontend.css ships a viewport-wide breakout
 * (`margin-left: calc(-50vw + 50%)`) plus, for the single
 * vendor/company/product heroes, a dark gradient and `color:#fff` title —
 * all leftovers from an older dark-hero design. The current design (the
 * "InfoCity" layer in frontend.css) renders EVERY plugin hero light/white
 * to sit cleanly inside Newspaper's white content area. So here we
 * normalise all heroes to one in-container light header: transparent
 * background, dark title, dark breadcrumbs. This also fixes the previously
 * invisible white-on-white titles/crumbs on single pages.
 * ============================================================ */
body.theme-newspaper .eco-hero {
    /* 22px top matches the theme's own breadcrumb row (.tdi_NN padding-top)
     * so our crumb doesn't stick to the menu bar like the theme's posts. */
    padding: 22px 0 18px !important;
    margin: 0 0 24px !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    background: none !important;
    color: inherit !important;
    border-radius: 0 !important;
    border-bottom: 1px solid var(--eco-gray-200);
    width: auto !important;
}
body.theme-newspaper .eco-hero .eco-hero-title {
    color: var(--eco-gray-900) !important;
    margin: 0 0 8px !important;
    font-size: 32px;
    line-height: 1.15;
    letter-spacing: -0.01em;
}
body.theme-newspaper .eco-hero .eco-breadcrumbs,
body.theme-newspaper .eco-hero .eco-breadcrumbs a,
body.theme-newspaper .eco-hero .eco-breadcrumb-sep {
    color: var(--eco-gray-500) !important;
}
body.theme-newspaper .eco-hero p,
body.theme-newspaper .eco-hero .eco-hero-subtitle {
    color: var(--eco-gray-600);
    margin: 0;
    font-size: 15px;
    line-height: 1.5;
}

/* ===== Dashboard stats row =================================== */
body.theme-newspaper .eco-dashboard-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0;
    margin: 24px 0 32px;
    border: 1px solid var(--eco-gray-200);
    border-radius: var(--eco-radius);
    overflow: hidden;
    background: #fff;
}
body.theme-newspaper .eco-dashboard-stat {
    padding: 22px 18px;
    border-right: 1px solid var(--eco-gray-200);
    background: #fff;
}
body.theme-newspaper .eco-dashboard-stat:last-child { border-right: 0; }
body.theme-newspaper .eco-dashboard-stat-value,
body.theme-newspaper .eco-dashboard-stat strong {
    display: block;
    font-size: 28px;
    line-height: 1.1;
    font-weight: 700;
    color: var(--eco-gray-900);
    margin-bottom: 4px;
}
body.theme-newspaper .eco-dashboard-stat-label,
body.theme-newspaper .eco-dashboard-stat small {
    display: block;
    font-size: 11px;
    color: var(--eco-gray-500);
    text-transform: uppercase;
    letter-spacing: 0.7px;
}

@media (max-width: 768px) {
    body.theme-newspaper .eco-dashboard-stats { grid-template-columns: repeat(2, 1fr); }
    body.theme-newspaper .eco-dashboard-stat:nth-child(2n) { border-right: 0; }
    body.theme-newspaper .eco-dashboard-stat:nth-child(-n+2) { border-bottom: 1px solid var(--eco-gray-200); }
}

/* ===== Section header (sidebar-style red bar like Newspaper) === */
body.theme-newspaper .eco-section-header,
body.theme-newspaper .eco-dashboard-section > h2 {
    position: relative;
    padding-left: 11px;
    border-left: 4px solid var(--eco-primary);
    line-height: 1;
    margin: 30px 0 18px;
    font-size: 15px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--eco-gray-900);
}

/* ===== Generic grid for industries / roles / vendors ========== */
body.theme-newspaper .eco-dashboard-industry-grid,
body.theme-newspaper .eco-dashboard-top-grid,
body.theme-newspaper .eco-dashboard-products-grid,
body.theme-newspaper .eco-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
    margin: 0 0 18px;
}

body.theme-newspaper .eco-card,
body.theme-newspaper .eco-dashboard-industry-grid > a,
body.theme-newspaper .eco-dashboard-top-grid > a,
body.theme-newspaper .eco-dashboard-products-grid > a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    background: #fff;
    border: 1px solid var(--eco-gray-200);
    border-radius: var(--eco-radius);
    color: var(--eco-gray-800);
    font-size: 14px;
    line-height: 1.35;
    text-decoration: none;
    transition: border-color 120ms ease, color 120ms ease;
}
body.theme-newspaper .eco-card:hover,
body.theme-newspaper .eco-dashboard-industry-grid > a:hover,
body.theme-newspaper .eco-dashboard-top-grid > a:hover,
body.theme-newspaper .eco-dashboard-products-grid > a:hover {
    border-color: var(--eco-primary);
    color: var(--eco-primary);
}

body.theme-newspaper .eco-card .eco-card-count,
body.theme-newspaper .eco-dashboard-industry-grid > a > span,
body.theme-newspaper .eco-dashboard-top-grid > a > span {
    flex-shrink: 0;
    font-size: 12px;
    color: var(--eco-gray-500);
    background: var(--eco-gray-100);
    padding: 2px 8px;
    border-radius: 2px;
}

/* ===== View-all link row ===================================== */
body.theme-newspaper .eco-dashboard-view-all {
    margin: 4px 0 28px;
    text-align: right;
}
body.theme-newspaper .eco-dashboard-view-all a {
    color: var(--eco-primary);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
body.theme-newspaper .eco-dashboard-view-all a:hover { text-decoration: underline; }

/* ===== Archive listings ====================================== */
body.theme-newspaper .eco-archive-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
    margin: 20px 0;
}
body.theme-newspaper .eco-archive-item {
    background: #fff;
    border: 1px solid var(--eco-gray-200);
    border-radius: var(--eco-radius);
    padding: 16px;
    transition: border-color 120ms ease;
}
body.theme-newspaper .eco-archive-item:hover { border-color: var(--eco-primary); }
body.theme-newspaper .eco-archive-item .eco-archive-title {
    margin: 0 0 6px;
    font-size: 16px;
    font-weight: 700;
}
body.theme-newspaper .eco-archive-item .eco-archive-title a {
    color: var(--eco-gray-900);
    text-decoration: none;
}
body.theme-newspaper .eco-archive-item .eco-archive-title a:hover { color: var(--eco-primary); }
body.theme-newspaper .eco-archive-item .eco-archive-meta {
    font-size: 12px;
    color: var(--eco-gray-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ===== Filters / tag chips =================================== */
body.theme-newspaper .eco-filter-btn,
body.theme-newspaper .eco-chip {
    display: inline-flex;
    align-items: center;
    padding: 5px 11px;
    background: #fff;
    border: 1px solid var(--eco-gray-300);
    border-radius: 2px;
    color: var(--eco-gray-700);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-decoration: none;
    cursor: pointer;
    transition: all 120ms ease;
}
body.theme-newspaper .eco-filter-btn:hover,
body.theme-newspaper .eco-chip:hover,
body.theme-newspaper .eco-filter-btn.active {
    background: var(--eco-primary);
    border-color: var(--eco-primary);
    color: #fff;
}

/* ===== Single-page meta / specs tables ======================= */
body.theme-newspaper .eco-meta-grid,
body.theme-newspaper .eco-specs-table {
    margin: 16px 0 24px;
    border-collapse: collapse;
    width: 100%;
}
body.theme-newspaper .eco-meta-grid td,
body.theme-newspaper .eco-specs-table td,
body.theme-newspaper .eco-meta-grid th,
body.theme-newspaper .eco-specs-table th {
    padding: 10px 14px;
    border-bottom: 1px solid var(--eco-gray-200);
    font-size: 14px;
    text-align: left;
}
body.theme-newspaper .eco-meta-grid th,
body.theme-newspaper .eco-specs-table th {
    color: var(--eco-gray-500);
    font-weight: 600;
    width: 30%;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 12px;
    background: var(--eco-gray-50);
}

/* ===== Graph page ============================================ */
body.theme-newspaper #eco-graph-container {
    height: 600px;
    border: 1px solid var(--eco-gray-200);
    border-radius: var(--eco-radius);
    overflow: hidden;
}
body.theme-newspaper .eco-graph-controls {
    margin: 16px 0;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}
body.theme-newspaper .eco-graph-stats {
    margin-left: auto;
    font-size: 12px;
    color: var(--eco-gray-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ===== Responsive ============================================ */
@media (max-width: 1024px) {
    body.theme-newspaper .eco-dashboard-industry-grid,
    body.theme-newspaper .eco-dashboard-top-grid,
    body.theme-newspaper .eco-dashboard-products-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
}
@media (max-width: 600px) {
    body.theme-newspaper .eco-wrap h1,
    body.theme-newspaper .eco-wrap .eco-hero-title { font-size: 24px; }
}
