/**
 * STA Wagtail Components CSS
 * Server-side rendered component styles
 */

/* ==========================================================================
   Base Reset - Ensure no unexpected margins/padding
   ========================================================================== */

body {
    margin: 0;
    padding: 0;
}

/* Navigation wrapper - matches AEM NavWrapper.module.scss */
[data-component="NavWrapper"] {
    position: absolute;
    right: 0;
    top: 0;
    left: 0;
    z-index: 17;
    width: 100%;
}

/* ==========================================================================
   AEM Grid System (Adobe Core Library)
   This is the responsive grid system used by AEM. Since we don't have AEM,
   we need to provide these styles ourselves.
   ========================================================================== */

.aem-Grid {
    display: block;
    width: 100%;
}

.aem-Grid::before,
.aem-Grid::after {
    display: table;
    content: " ";
}

.aem-Grid::after {
    clear: both;
}

/* 12 column grid */
.aem-Grid--12 > .aem-GridColumn {
    float: left;
    clear: none;
}

/* Default column widths */
.aem-GridColumn--default--12 {
    float: none;
    clear: both;
    width: 100%;
}

.aem-GridColumn--default--11 {
    width: 91.66666667%;
}

.aem-GridColumn--default--10 {
    width: 83.33333333%;
}

.aem-GridColumn--default--9 {
    width: 75%;
}

.aem-GridColumn--default--8 {
    width: 66.66666667%;
}

.aem-GridColumn--default--7 {
    width: 58.33333333%;
}

.aem-GridColumn--default--6 {
    width: 50%;
}

.aem-GridColumn--default--5 {
    width: 41.66666667%;
}

.aem-GridColumn--default--4 {
    width: 33.33333333%;
}

.aem-GridColumn--default--3 {
    width: 25%;
}

.aem-GridColumn--default--2 {
    width: 16.66666667%;
}

.aem-GridColumn--default--1 {
    width: 8.33333333%;
}

/* Offset */
.aem-GridColumn--default--offset--0 {
    margin-left: 0;
}

.aem-GridColumn--default--offset--1 {
    margin-left: 8.33333333%;
}

.aem-GridColumn--default--offset--2 {
    margin-left: 16.66666667%;
}

.aem-GridColumn--default--offset--3 {
    margin-left: 25%;
}

.aem-GridColumn--default--offset--4 {
    margin-left: 33.33333333%;
}

.aem-GridColumn--default--offset--5 {
    margin-left: 41.66666667%;
}

.aem-GridColumn--default--offset--6 {
    margin-left: 50%;
}

/* Responsive grid - phone */
@media (max-width: 650px) {
    .aem-GridColumn--phone--12 {
        float: none;
        clear: both;
        width: 100%;
    }

    .aem-GridColumn--phone--hide {
        display: none !important;
    }
}

/* Responsive grid - tablet */
@media (min-width: 651px) and (max-width: 1024px) {
    .aem-GridColumn--tablet--12 {
        float: none;
        clear: both;
        width: 100%;
    }

    .aem-GridColumn--tablet--6 {
        width: 50%;
    }

    .aem-GridColumn--tablet--hide {
        display: none !important;
    }
}

/* Responsive container */
.responsivegrid {
    width: 100%;
}

/* Root container - full width for edge-to-edge components */
.root.responsivegrid {
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0;
}

.root.responsivegrid > .aem-Grid {
    max-width: 100%;
    margin: 0;
    padding: 0;
}

/* Ensure nested grids also get full width */
.root.responsivegrid .aem-GridColumn--default--12 {
    width: 100%;
    max-width: 100%;
    padding: 0;
}

/* ==========================================================================
   Hero Slider (Dynamic News Slider)
   ========================================================================== */

.hero-slider {
    position: relative;
    width: 100%;
    min-height: 500px;
    overflow: hidden;
    background: #1a1a1a;
}

.hero-slider .slider-container {
    position: relative;
    width: 100%;
    height: 100%;
}

.hero-slider .slides-wrapper {
    position: relative;
    width: 100%;
    height: 500px;
}

.hero-slider .slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.5s ease;
    display: flex;
    align-items: center;
}

.hero-slider .slide.active {
    opacity: 1;
    z-index: 1;
}

.hero-slider .slide-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.hero-slider .slide-background::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to right, rgba(0,0,0,0.7) 0%, rgba(0,0,0,0.3) 50%, transparent 100%);
}

.hero-slider .slide-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hero-slider .slide-content {
    position: relative;
    z-index: 2;
    max-width: 600px;
    padding: 2rem 4rem;
    color: #fff;
}

.hero-slider .slide-tag {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: rgba(255,255,255,0.2);
    border-radius: 4px;
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.hero-slider .slide-title {
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1.2;
    margin: 0 0 1rem 0;
}

.hero-slider .slide-description {
    font-size: 1rem;
    line-height: 1.6;
    margin: 0 0 1.5rem 0;
    opacity: 0.9;
}

.hero-slider .slide-cta {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background: #0a8a4a;
    color: #fff;
    text-decoration: none;
    border-radius: 4px;
    font-weight: 500;
    transition: background 0.3s ease;
}

.hero-slider .slide-cta:hover {
    background: #07703d;
}

.hero-slider .slider-dots {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 0.5rem;
    z-index: 10;
}

.hero-slider .dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: rgba(255,255,255,0.5);
    border: none;
    cursor: pointer;
    transition: background 0.3s ease;
}

.hero-slider .dot.active {
    background: #fff;
}

.hero-slider .slider-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    background: rgba(255,255,255,0.2);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    z-index: 10;
    transition: background 0.3s ease;
}

.hero-slider .slider-nav:hover {
    background: rgba(255,255,255,0.3);
}

.hero-slider .slider-nav.prev {
    left: 1rem;
}

.hero-slider .slider-nav.next {
    right: 1rem;
}

/* ==========================================================================
   Card Container
   ========================================================================== */

.card-container {
    padding: 3rem 2rem;
}

.card-container--ecosystem-card {
    background: #0a8a4a;
    color: #fff;
}

.card-container--with-background {
    background: #f5f5f5;
}

.card-container.bg-green {
    background: #0a8a4a;
    color: #fff;
}

.card-container.bg-teal {
    background: #1a8a8a;
    color: #fff;
}

.card-container.bg-black {
    background: #1a1a1a;
    color: #fff;
}

.card-container__header {
    text-align: center;
    max-width: 800px;
    margin: 0 auto 2rem;
}

.card-container__heading {
    font-size: 2rem;
    font-weight: 700;
    margin: 0 0 1rem 0;
}

.card-container__subheading {
    font-size: 1rem;
    line-height: 1.6;
    opacity: 0.9;
    margin: 0;
}

.card-container__subheading.hide-mobile {
    display: block;
}

@media (max-width: 768px) {
    .card-container__subheading.hide-mobile {
        display: none;
    }
}

.card-container__cards {
    position: relative;
    overflow-x: auto;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.card-container__cards::-webkit-scrollbar {
    display: none;
}

.card-container__cards.scrollable {
    overflow-x: auto;
}

.cards-track {
    display: flex;
    gap: 1.5rem;
    padding: 1rem 0;
}

/* Non-scrollable: grid layout */
.card-container__cards:not(.scrollable) .cards-track {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

/* Scrollable: flex layout with fixed width cards */
.card-container__cards.scrollable .cards-track {
    display: flex;
    flex-wrap: nowrap;
}

/*
 * Card styles are now handled by the React component's CSS modules.
 * These global .card styles were conflicting with the scoped CardWrapper styles.
 * Specifically, the border-radius: 12px conflicted with promotion-card's border-radius: 16px
 * and the box-shadow was adding extra shadows not in AEM.
 *
 * The React CardContainer uses its own CardWrapper.module.scss for card styling.
 */

/* Only apply card styles to server-rendered cards in .cards-track, not React components */
.cards-track > .card {
    flex: 0 0 auto;
    width: 350px;
    background: #fff;
}

.cards-track > .card--medium {
    width: 350px;
}

.cards-track > .card--small {
    width: 280px;
}

.card__image {
    width: 100%;
    height: 200px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.05);
    padding: 1.5rem;
}

.card-container--ecosystem-card .card__image {
    height: 150px;
}

.card__image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.card__content {
    padding: 1.5rem;
}

.card__tag {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: rgba(10,138,74,0.1);
    color: #0a8a4a;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    margin-bottom: 0.75rem;
}

.card-container--ecosystem-card .card__tag {
    background: rgba(255,255,255,0.2);
    color: #fff;
}

.card__title {
    font-size: 1.125rem;
    font-weight: 600;
    margin: 0 0 0.75rem 0;
    line-height: 1.3;
}

.card__description {
    font-size: 0.875rem;
    line-height: 1.6;
    color: #666;
    margin: 0 0 1rem 0;
}

.card__description ul {
    margin: 0;
    padding-left: 1.25rem;
}

.card__description li {
    margin-bottom: 0.5rem;
}

.card-container--ecosystem-card .card__description,
.card-container.bg-green .card__description {
    color: rgba(255,255,255,0.8);
}

.card__date {
    display: block;
    font-size: 0.75rem;
    color: #999;
    margin-bottom: 1rem;
}

.card__link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: #0a8a4a;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.875rem;
}

.card-container--ecosystem-card .card__link {
    color: #fff;
}

.card__link:hover {
    text-decoration: underline;
}

.card__login-required {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    background: #f0f0f0;
    color: #666;
    font-size: 0.75rem;
    border-radius: 4px;
}

.cards-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    background: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    z-index: 10;
}

.cards-nav.prev {
    left: 0;
}

.cards-nav.next {
    right: 0;
}

/* ==========================================================================
   Stats Component
   ========================================================================== */

.stats {
    padding: 3rem 2rem;
    text-align: center;
}

.stats__title {
    font-size: 2rem;
    font-weight: 700;
    margin: 0 0 1rem 0;
}

.stats__description {
    max-width: 800px;
    margin: 0 auto;
    font-size: 1rem;
    line-height: 1.6;
    color: #666;
}

/* ==========================================================================
   News Index Page
   ========================================================================== */

.news-index {
    padding: 2rem;
}

.news-intro {
    max-width: 800px;
    margin: 0 auto 2rem;
    text-align: center;
}

.news-articles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.news-card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    /* Removed transform transition - AEM doesn't have this */
}

/* Removed hover transform - AEM cards don't have this animation */

.news-card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.news-card-content {
    padding: 1.5rem;
}

.news-card .category {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: rgba(10,138,74,0.1);
    color: #0a8a4a;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    margin-bottom: 0.75rem;
}

.news-card h3 {
    font-size: 1.125rem;
    margin: 0 0 0.75rem 0;
}

.news-card h3 a {
    color: #1a1a1a;
    text-decoration: none;
}

.news-card h3 a:hover {
    color: #0a8a4a;
}

.news-card p {
    font-size: 0.875rem;
    color: #666;
    margin: 0 0 1rem 0;
    line-height: 1.6;
}

.news-card time {
    font-size: 0.75rem;
    color: #999;
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-top: 2rem;
}

.pagination a {
    padding: 0.5rem 1rem;
    background: #0a8a4a;
    color: #fff;
    text-decoration: none;
    border-radius: 4px;
}

.pagination .current {
    color: #666;
}

/* ==========================================================================
   News Article Page
   Note: Using AEM NewsArticle React component - styles come from site.css
   Do NOT add .news-article class here as it conflicts with AEM's dynamic class
   ========================================================================== */

/* ==========================================================================
   Responsive Adjustments
   ========================================================================== */

/* ==========================================================================
   Ecosystem Card - Match AEM Production Styles
   The AEM SCSS uses: image-wrapper height 130px, picture height 200px/160px mobile
   Let the AEM React component styles handle this - no overrides needed
   ========================================================================== */

/* ==========================================================================
   Rich Text Block - Base Typography
   Matches AEM _rte-text-components.scss styling.
   Ensures rich text looks correct even after Draftail strips custom CSS
   classes (terms-privacy-cookies-*, copy-large, etc.) when users edit
   pages in Wagtail admin.
   ========================================================================== */

.rich-text-block {
    width: 85%;
    margin-left: auto;
    margin-right: auto;
    padding-bottom: 50px;
    font-family: "IBMPlexSansArabic", "IBM Plex Sans Arabic", Helvetica, Arial, sans-serif;
    font-style: normal;
    font-weight: 400;
    font-size: 18px;
    line-height: 26px;
    color: #303030;
}

@media screen and (min-width: 1024px) {
    .rich-text-block {
        font-size: 20px;
        line-height: 30px;
        padding-bottom: 100px;
    }
}

/* When .terms-privacy-cookies is still present (management command content),
   reset its width and padding so we don't get double 85% or double padding */
.rich-text-block .terms-privacy-cookies {
    width: 100%;
    padding-bottom: 0;
}

.rich-text-block p {
    display: block;
    margin-block-start: 1em;
    margin-block-end: 1em;
    font-size: inherit;
    line-height: inherit;
    color: inherit;
}

.rich-text-block h2,
.rich-text-block h3,
.rich-text-block h4 {
    font-family: "IBMPlexSansArabic", "IBM Plex Sans Arabic", Helvetica, Arial, sans-serif;
    font-weight: 700;
    font-size: 26px;
    line-height: 30px;
    color: #303030;
    margin-top: 60px;
    margin-bottom: 30px;
}

@media screen and (min-width: 1024px) {
    .rich-text-block h2,
    .rich-text-block h3,
    .rich-text-block h4 {
        font-size: 30px;
        line-height: 36px;
    }
}

.rich-text-block ul,
.rich-text-block ol {
    list-style-type: disc;
    margin-top: 0;
    padding-left: 28px;
    font-size: inherit;
    line-height: inherit;
}

.rich-text-block ol {
    list-style-type: decimal;
}

[dir="rtl"] .rich-text-block ul,
[dir="rtl"] .rich-text-block ol {
    padding-left: unset;
    padding-right: 28px;
}

@media screen and (min-width: 1024px) {
    .rich-text-block ul,
    .rich-text-block ol {
        padding-left: 30px;
    }
    [dir="rtl"] .rich-text-block ul,
    [dir="rtl"] .rich-text-block ol {
        padding-left: unset;
        padding-right: 30px;
    }
}

.rich-text-block li {
    font-size: inherit;
    line-height: inherit;
    margin-bottom: 0.5em;
}

.rich-text-block a,
.rich-text-block a:hover {
    color: #308138;
}

.rich-text-block table,
.rich-text-block td,
.rich-text-block th {
    border: 1px solid #cccccc;
    background: #f8f8f8;
}

.rich-text-block table {
    width: 100%;
    margin-top: 10px;
    border-collapse: collapse;
}

.rich-text-block td,
.rich-text-block th {
    padding: 10px;
    font-size: inherit;
    line-height: inherit;
}

.rich-text-block th {
    background: #e6e6e6;
    font-weight: 700;
}

@media screen and (min-width: 1024px) {
    .rich-text-block td,
    .rich-text-block th {
        padding: 25px 20px;
    }
}

/* ==========================================================================
   Responsive Adjustments
   ========================================================================== */

@media (max-width: 768px) {
    .hero-slider {
        min-height: 400px;
    }

    .hero-slider .slides-wrapper {
        height: 400px;
    }

    .hero-slider .slide-content {
        padding: 1.5rem;
    }

    .hero-slider .slide-title {
        font-size: 1.75rem;
    }

    .hero-slider .slider-nav {
        display: none;
    }

    .card-container {
        padding: 2rem 1rem;
    }

    /* Scoped to server-rendered cards only */
    .cards-track > .card {
        width: 280px;
    }

    .cards-track > .card--medium {
        width: 280px;
    }

    .news-article {
        padding: 1rem;
    }

    .article-header h1 {
        font-size: 1.75rem;
    }
}
