/* ============================================================
   CATEGORY DESCRIPTION — PREMIUM B2B EDITORIAL UX
   ============================================================ */

/* Main Container */
div img {
    z-index: 1;
    position: relative;
}
.category-description-card {
    background: transparent;
    margin: 20px 0 0 0;
    padding: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
    color: #334155; /* Slate 700 - Better contrast */
}

.cat-desc-content-wrapper {
    position: relative;
    background: #f8fafc; /* Slate 50 */
    border: 1px solid #e2e8f0;
    border-left: 6px solid #1a3353; /* Navy accent */
    border-radius: 0; /* Zero radius to snap to edges/footer */
    padding: 32px 40px; /* Reduced vertical and horizontal padding for tighter look */
    box-shadow: 0 12px 32px -4px rgba(15, 23, 42, 0.06), 0 4px 12px -2px rgba(15, 23, 42, 0.04);
}

/* Base resets & Mitigations for WYSIWYG */
.cat-desc-content {
    word-break: break-word; /* Prevent long URLs from breaking layout */
    overflow-wrap: break-word;
}

/* Kill global h2:before { content:''; margin-right:10px } and h3 { color:white; padding:20px } from _pg-global.less */
.cat-desc-content h2::before,
.cat-desc-content h3::before {
    content: none;
    margin: 0;
}
.cat-desc-content h3 {
    color: inherit;
    padding: 0;
}

/* Handle space blocks */
.cat-desc-content > * + * {
    margin-top: 20px; /* Tighter vertical spacing */
}
.cat-desc-content > :first-child,
.cat-desc-content .cat-desc > :first-child {
    margin-top: 0 !important;
}
.cat-desc-content > :last-child,
.cat-desc-content .cat-desc > :last-child {
    margin-bottom: 0 !important;
}

/* =====================================
   TYPOGRAPHY HIERARCHY
   ===================================== */
.cat-desc-content h1,
.cat-desc-content h2,
.cat-desc-content h3,
.cat-desc-content h4 {
    color: #0f172a; /* Slate 900 */
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -0.02em;
    margin-top: 36px;
    margin-bottom: 16px;
}

/* The first heading acts as a Hero / Intro Title */
.cat-desc-content h1:first-of-type,
.cat-desc-content .cat-desc > h1:first-of-type,
.cat-desc-content .cat-desc > h2:first-of-type {
    font-size: 32px;
    margin-top: 0;
    padding-bottom: 20px;
    border-bottom: 2px solid #e2e8f0;
    position: relative;
    color: #1a3353;
}
.cat-desc-content h1:first-of-type::after,
.cat-desc-content .cat-desc > h1:first-of-type::after,
.cat-desc-content .cat-desc > h2:first-of-type::after {
    content: "";
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 80px;
    height: 2px;
    background: #2563a0;
}

/* Standard H2 acts as section divider */
.cat-desc-content h2:not(:first-of-type) {
    font-size: 24px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e2e8f0;
}

.cat-desc-content h3 {
    font-size: 18px;
    color: #0f172a;
    margin-top: 24px;
}

/* =====================================
   READABILITY & SPACING
   ===================================== */
.cat-desc-content p {
    font-size: 16px;
    line-height: 1.7;
    margin-bottom: 20px;
    color: #334155; /* Stronger contrast */
}

/* Technical Callout Blocks (Strong at block level) */
.cat-desc-content p > strong:only-child,
.cat-desc-content .cat-desc > strong,
.cat-desc-content > strong {
    display: block;
    padding: 16px 20px;
    background: #ffffff;
    color: unset; /* user request */
    border: 1px solid #e2e8f0;
    border-left: 4px solid #3b82f6; /* Bright blue accent */
    border-radius: 6px;
    margin-top: 24px;
    margin-bottom: 24px;
    font-weight: 600;
    font-size: 15px; /* Tighter font for callout */
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}

/* Inline b and strong */
.cat-desc-content b,
.cat-desc-content strong,
.cat-desc-content p b,
.cat-desc-content p strong {
    font-weight: 600;
    color: unset;
}
.cat-desc-content a {
    color: #2563a0;
    text-decoration: underline;
    text-underline-offset: 4px;
    font-weight: 500;
    transition: color 0.2s ease;
}
.cat-desc-content a:hover {
    color: #1a3353;
    text-decoration: none;
}

/* =====================================
   TECHNICAL B2B LISTS (Seamless Integration)
   ===================================== */

/* ul container — (0,2,1) beats .column.main ul (0,1,1); :not() keeps FAQ out */
.cat-desc-content ul:not(.faq-ul),
.cat-desc-content .cat-desc > ul:not(.faq-ul) {
    list-style: none;
    margin: 24px 0;
    padding: 0;
    background: transparent;
    border: none;
    box-shadow: none;
    /*
    display: flex;
    flex-direction: column;
    gap: 10px;
    */
}

/* counter-reset on the ul itself */
.cat-desc-content ul:not(.faq-ul) {
    counter-reset: list-counter;
}

/* floating <li> without a <ul> — WYSIWYG mess */
.cat-desc-content > li {
    list-style: none;
}

/* Card-style li — :not() guards keep FAQ elements untouched */
.cat-desc-content li:not(.faq-li):not(.faq-slide) {
    position: relative;
    padding: 14px 18px 14px 52px;
    margin: 0;
    line-height: 1.6;
    font-size: 15px;
    color: #334155;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-left: 4px solid #2563a0;
    border-radius: 6px;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.04);
    transition: border-left-color 0.2s ease, box-shadow 0.2s ease;
}

.cat-desc-content li:not(.faq-li):not(.faq-slide):hover {
    border-left-color: #1a3353;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08);
}

/* Numbered badge — counter-based, no mask/SVG */
.cat-desc-content li:not(.faq-li):not(.faq-slide)::before {
    content: counter(list-counter);
    counter-increment: list-counter;
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 26px;
    height: 26px;
    background: #1a3353;
    color: #ffffff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0;
    font-family: 'Inter', system-ui, sans-serif;
    /* clear any mask from previous styles */
    -webkit-mask-image: none;
    mask-image: none;
}

/* single-item list — dash instead of "1" */
.cat-desc-content ul:not(.faq-ul) li:only-child::before {
    content: "–";
    font-size: 14px;
    background: #2563a0;
}

/* paragraph/div inside card li — exclude .faq-slide-data which needs display:block for the accordion */
.cat-desc-content li p,
.cat-desc-content li div:not(.faq-slide-data) {
    margin: 0;
    display: inline;
}

.cat-desc-content li p + p,
.cat-desc-content li div:not(.faq-slide-data) + div:not(.faq-slide-data) {
    display: block;
    margin-top: 6px;
}

/* links inside li */
.cat-desc-content li:not(.faq-li):not(.faq-slide) a {
    color: #2563a0;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* =====================================
   TECHNICAL TABLES (Resilient)
   ===================================== */
/* Force wrapping if not already wrapped to stop layout breaks */
.cat-desc-content table {
    width: 100%;
    min-width: 600px; /* Force scroll on small screens */
    border-collapse: collapse;
    background: #ffffff;
    border-radius: 8px;
    overflow: hidden;
    margin: 32px 0;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.05);
    border: 1px solid #e2e8f0;
}

/* We style a pseudo-wrapper for mobile overflow if table is naked */
.cat-desc-content table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.cat-desc-content th,
.cat-desc-content td {
    padding: 14px 16px;
    border-bottom: 1px solid #e2e8f0;
    text-align: left;
    font-size: 14px; /* Tighter table font */
    vertical-align: top;
}

.cat-desc-content th {
    background: #f1f5f9;
    color: #0f172a;
    font-weight: 600;
    white-space: nowrap;
}

.cat-desc-content tbody tr:last-child td {
    border-bottom: none;
}

.cat-desc-content tbody tr:nth-child(even) {
    background: #fafafa;
}

.cat-desc-content tbody tr:hover {
    background: #f1f5f9;
}

/* =====================================
   SAFE MEDIA HANDLING (Images/Video)
   ===================================== */
.cat-desc-content img {
    max-width: 100% !important;
    height: auto !important;
    border-radius: 8px;
    display: inline-block;
}

/* Exploded Cylinder special fix for WYSIWYG */
.cat-desc-content .exploded.cylinder {
    text-align: center;
    margin: 32px 0;
}

/* Embedded iframe/video safeguards */
.cat-desc-content iframe,
.cat-desc-content .video-wrapper {
    width: 100%;
    aspect-ratio: 16 / 9;
    height: auto !important; /* Override hardcoded inline heights */
    border: none;
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.1);
    margin: 48px 0;
    display: block;
}

/* The existing custom Youtube embed pattern */
.cat-desc-content .youtube {
    position: relative;
    margin: 48px 0 !important;
    width: 100%;
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.1);
    overflow: hidden;
    cursor: pointer;
    background: #000;
}
.cat-desc-content .youtube img {
    display: block;
    width: 100% !important;
    aspect-ratio: 16 / 9;
    height: auto !important;
    object-fit: cover;
    opacity: 0.85;
    transition: opacity 0.3s ease;
}

/* Extracted Youtube Play Button */
.cat-desc-content .youtube .play {
    font-size: 1.1em;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #ef4444; /* Brighter modern red */
    opacity: 0.9;
    border-radius: 50% / 10%;
    color: #FFFFFF;
    height: 3em;
    padding: 0;
    text-align: center;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    width: 4em;
    z-index: 2;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

.cat-desc-content .youtube .play::before {
    background: inherit;
    border-radius: 5% / 50%;
    bottom: 9%;
    content: "";
    left: -5%;
    position: absolute;
    right: -5%;
    top: 9%;
}

.cat-desc-content .youtube .play::after {
    border-style: solid;
    border-width: 1em 0 1em 1.732em;
    border-color: transparent transparent transparent #ffffff;
    content: ' ';
    font-size: 0.75em;
    height: 0;
    margin: -1em 0 0 -0.75em;
    top: 50%;
    left: 50%;
    position: absolute;
    width: 0;
}

.cat-desc-content .youtube:hover .play {
    transform: translate(-50%, -50%) scale(1.05); /* Modern scale */
    box-shadow: 0 8px 24px rgba(239, 68, 68, 0.6);
}
.cat-desc-content .youtube:hover img {
    opacity: 1;
}

/* =====================================
   FAQ SECTION (Integrated styling)
   ===================================== */
.cat-desc-content .faq-main-div {
    margin: 48px 0 24px;
    background: #ffffff;
    border-radius: 12px;
    padding: 32px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.03);
}

/* faq-h2 heading — let faq.css handle border/padding; only assert what global h2 { padding:20px } would break */
.cat-desc-content .faq-h2 {
    font-size: 20px;
    color: #0f172a;
    font-weight: 700;
    letter-spacing: -0.01em;
    margin-top: 0;
    margin-bottom: 24px;
    padding: 0 0 14px;          /* override global h2 { padding: 20px } */
    border-top: none;
    position: relative;         /* needed for ::after accent line */
}

/* FAQ ul — :not(.faq-ul) already keeps card rules off; these are purely additive */
.cat-desc-content .faq-ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: block;  /* override flex from the card ul rule — .faq-ul is excluded but belt-and-suspenders */
    gap: unset;
    background: none;
    border: none;
    box-shadow: none;
}

/* FAQ li — :not(.faq-li):not(.faq-slide) already keeps card/counter rules off */
.cat-desc-content .faq-li {
    padding: 0;
    margin-bottom: 0;
    border: none;
    background: transparent;
    box-shadow: none;
    border-radius: 0;
}
.cat-desc-content .faq-li::before,
.cat-desc-content .faq-slide::before {
    display: none;
}

.cat-desc-content .faq-slide {
    padding: 0 0 12px;
    margin-bottom: 12px;
    border-bottom: 1px solid #e2e8f0;
}

.cat-desc-content .faq-slide:last-child {
    margin-bottom: 0;
    border-bottom: none;
    padding-bottom: 0;
}

.cat-desc-content .faq-slide-title {
    font-size: 15px;
    font-weight: 600;
    color: #1a3353;
    margin: 0;              /* override global h3 { margin: 0.67em 0 } */
    padding: 16px 4px;      /* override global h3 { padding: 20px } — faq.css value */
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    line-height: 1.5;
    transition: color 0.2s ease;
}
.cat-desc-content .faq-slide-title:hover {
    color: #2563a0;
}
/* icon — color handled by faq.css mask background-color, not FA color */
.cat-desc-content .faq-slide-title i {
    flex-shrink: 0;
}

.cat-desc-content .faq-slide-data {
    font-size: 14px;
    color: #334155;
    line-height: 1.6;
}

/* =====================================
   READ MORE TOGGLE SYSTEM (Smooth)
   ===================================== */
.category-description-card.is-long-description .cat-desc-content {
    max-height: 480px;
    overflow: hidden;
    transition: max-height 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.category-description-card.is-long-description .cat-desc-content::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 160px;
    background: linear-gradient(180deg, rgba(248,250,252,0) 0%, rgba(248,250,252,0.8) 40%, #f8fafc 100%);
    pointer-events: none;
    transition: opacity 0.4s ease;
    border-radius: 0;
}

.cat-desc-toggle-checkbox {
    display: none;
}

/* When expanded */
.cat-desc-toggle-checkbox:checked ~ .cat-desc-content-wrapper .cat-desc-content {
    max-height: 9999px;
}

.cat-desc-toggle-checkbox:checked ~ .cat-desc-content-wrapper .cat-desc-content::after {
    opacity: 0;
}

.cat-desc-actions {
    display: flex;
    justify-content: center;
    margin-top: -24px;
    position: relative;
    z-index: 10;
}

/* Solid Modern Button */
.cat-desc-toggle-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: #1a3353;
    color: #ffffff;
    padding: 14px 32px;
    border-radius: 8px; /* Slightly squarer technical button */
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(26, 51, 83, 0.2);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.cat-desc-toggle-btn::after {
    content: "";
    display: inline-block;
    width: 18px;
    height: 18px;
    background-color: currentColor;
    -webkit-mask-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="6 9 12 15 18 9"></polyline></svg>');
    mask-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="6 9 12 15 18 9"></polyline></svg>');
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-position: center;
    transition: transform 0.3s ease;
}

.cat-desc-toggle-checkbox:checked ~ .cat-desc-content-wrapper .cat-desc-actions .cat-desc-toggle-btn::after {
    transform: rotate(180deg);
}

.cat-desc-toggle-btn:hover {
    background: #2563a0;
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(37, 99, 160, 0.25);
}

/* Control text visibility based on checkbox */
.cat-desc-toggle-checkbox ~ .cat-desc-content-wrapper .cat-desc-actions .text-less {
    display: none;
}
.cat-desc-toggle-checkbox:checked ~ .cat-desc-content-wrapper .cat-desc-actions .text-more {
    display: none;
}
.cat-desc-toggle-checkbox:checked ~ .cat-desc-content-wrapper .cat-desc-actions .text-less {
    display: inline;
}

/* =====================================
   RESPONSIVE
   ===================================== */
@media screen and (max-width: 991px) {
    .cat-desc-content-wrapper {
        padding: 32px 36px;
    }
}

@media screen and (max-width: 767px) {
    .category-description-card {
        margin: 20px 0 0 0;
    }
    .cat-desc-content-wrapper {
        padding: 24px 20px;
        border-radius: 0;
        border-left-width: 4px;
    }
    .cat-desc-content h1:first-of-type, 
    .cat-desc-content .cat-desc > h1:first-of-type,
    .cat-desc-content .cat-desc > h2:first-of-type {
        font-size: 26px;
        margin-top: 0;
        padding-bottom: 16px;
    }
    .cat-desc-content h2:not(:first-of-type) {
        font-size: 20px;
        margin-top: 24px;
    }
    .cat-desc-content iframe,
    .cat-desc-content .youtube {
        margin: 32px 0 !important;
        border-radius: 8px;
    }
    .cat-desc-content ul:not(.faq-ul),
    .cat-desc-content .cat-desc > ul:not(.faq-ul) {
        margin: 16px 0;
    }
    .cat-desc-content li:not(.faq-li):not(.faq-slide) {
        padding: 12px 14px 12px 48px;
        font-size: 14px;
    }
    .cat-desc-content li:not(.faq-li):not(.faq-slide)::before {
        left: 12px;
        width: 24px;
        height: 24px;
        font-size: 10px;
    }
    .cat-desc-content table {
        margin: 24px 0;
    }
    .cat-desc-content th,
    .cat-desc-content td {
        padding: 12px 14px;
        font-size: 13px;
    }
    .cat-desc-content p > strong:only-child,
    .cat-desc-content .cat-desc > strong,
    .cat-desc-content > strong {
        padding: 14px 16px;
        font-size: 14px;
    }
    .cat-desc-toggle-btn {
        width: 100%; /* Full width easy touch target on mobile */
        padding: 16px 20px;
    }
    .category-description-card.is-long-description .cat-desc-content {
        max-height: 520px; /* Slight bump for mobile vertical flow */
    }
    .category-description-card.is-long-description .cat-desc-content::after {
        height: 120px;
    }
    .cat-desc-content .faq-main-div {
        padding: 20px 16px;
    }
}
