/* ==========================================
   SX NEWS (JOOMLA CATEGORY BLOG OVERRIDE)
========================================== */
.sx-news {
  --sx-bg: #ffffff;
  --sx-text: #4a4a4a;
  --sx-heading: #1a1a1a;
  --sx-brand-blue: rgb(45, 132, 205);
  --sx-blue-light: rgba(45, 132, 205, 0.08);
  --sx-border: #eaeaea;
}

section.sx-news {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 20px;
  font-family: 'Helvetica Neue', Arial, sans-serif;
}

/* ==========================================
   1. UNIVERSAL IMAGE FIX (16:9 Aspect Ratio)
========================================== */
.sx-news .item-image img,
.sx-news figure img {
  width: 100% !important;
  max-width: none !important;
  height: 100% !important;
  aspect-ratio: 16 / 9; 
  object-fit: cover !important; 
  display: block !important;
  margin: 0 !important;
  border-radius: 8px !important; 
}

/* ==========================================
   2. HIERARCHY 1: THE LEADING ARTICLE (HERO)
========================================== */
.sx-news .items-leading {
  width: 100% !important;
  max-width: 100% !important;
  display: flex !important;
  justify-content: center !important;
  margin-bottom: 60px !important;
}

.sx-news .items-leading .item {
  display: flex !important;
  flex-direction: column;
  background: var(--sx-bg);
  border: 1px solid var(--sx-border);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 10px 40px rgba(0,0,0,0.04);
  width: 100% !important; 
  max-width: 1000px !important; 
  margin: 0 !important;
}

/* Desktop 50/50 Split Override */
@media (min-width: 900px) {
  .items-leading .item-content.item-media-top.post-regular.position-relative {
    display: flex;
    flex-direction: row;
    align-items: center;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
  }

  .items-leading .item-content.item-media-top.post-regular.position-relative > .left.item-image {
    width: 550px;
    flex: 0 0 50%;
    max-width: 550px;
    margin: 0;
    padding: 0;
    display: flex; /* Remove flex here */
    aspect-ratio: 16 / 9;
    position: relative;
    overflow: hidden;
    height: auto; /* Let aspect-ratio control height */

  }
  .items-leading .item-content.item-media-top.post-regular.position-relative > .left.item-image img {
    width: 550px !important;
    height: auto !important;
    aspect-ratio: 16 / 9 !important;
    object-fit: cover !important;
    display: flex !important;
    border-radius: 8px !important;
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
  }


  .items-leading .item-content.item-media-top.post-regular.position-relative > .d-flex.flex-column.has-image {
    width: 50%;
    flex: 1 1 50%;
    max-width: 50%;
    padding: 50px;
    display: flex;
    flex-direction: column;
    justify-content: center !important;
  }
}

/* ==========================================
   3. HIERARCHY 2: THE INTRO ARTICLES (GRID)
========================================== */
.sx-news .items-row .item {
  display: flex !important;
  flex-direction: column !important;
  height: 100% !important; 
  background: var(--sx-bg);
  border: 1px solid var(--sx-border);
  border-radius: 8px; /* Standardized to 8px */
  box-shadow: 0 4px 15px rgba(0,0,0,0.02);
  transition: all 0.3s ease;
  overflow: hidden;
}

.sx-news .items-row .item:hover {
  border-color: rgba(45, 132, 205, 0.3);
  box-shadow: 0 10px 30px rgba(0,0,0,0.05);
  transform: translateY(-3px);
}

/* Target the text wrapper inside grid cards to fill space */
.sx-news .items-row .item > div:not(.item-image):not(figure) {
  display: flex !important;
  flex-direction: column !important;
  flex-grow: 1 !important;
  padding: 25px !important;
}

/* ==========================================
   4. TYPOGRAPHY (Targeting Native Joomla Tags)
========================================== */
/* Article Titles */
.sx-news .item-title {
  font-size: 1.4rem;
  color: var(--sx-heading);
  margin: 15px 0 10px 0;
  font-weight: 600;
  line-height: 1.3;
}
.sx-news .items-leading .item-title {
  font-size: 2rem !important; /* Bigger title for Hero */
}
.sx-news .item-title a {
  color: inherit;
  text-decoration: none;
  transition: color 0.3s;
}
.sx-news .item-title a:hover {
  color: var(--sx-brand-blue);
}

/* Paragraphs (Standard Excerpt Text) */
.sx-news .item p {
  color: var(--sx-text);
  font-size: 1rem;
  line-height: 1.6;
  margin: 0 0 20px 0;
}

/* ==========================================
   6. THE META TAGS (Paste these in Joomla editor)
========================================== */
.sx-news-meta {
  display: flex; align-items: center; gap: 15px;
  font-size: 0.85rem; font-family: 'Courier New', monospace;
  margin-bottom: 10px;
}
.sx-news-tag {
  padding: 4px 10px; border-radius: 4px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.5px;
}
.tag-event { background: var(--sx-blue-light); color: var(--sx-brand-blue); }
.tag-release { background: rgba(46, 204, 113, 0.1); color: #27ae60; }
.tag-company { background: rgba(100, 100, 100, 0.1); color: #555; }
.sx-news-date { color: #888; }

/* ========================================
   NEWS ARCHIVE BLOCK
======================================== */

.sx-news-archive {
  padding: 40px 0 60px;
  border-top: 1px solid #e6ecec;
  margin-top: 30px;
}

.sx-news-archive-inner {
  max-width: 720px;
  margin: 0 auto;
  text-align: center;
}

.sx-news-archive-title {
  font-size: 22px;
  font-weight: 600;
  color: #1c2a2a;
  margin-bottom: 12px;
}

.sx-news-archive-desc {
  font-size: 15px;
  line-height: 1.6;
  color: #5f6e6e;
  margin-bottom: 28px;
}

.sx-news-archive-btn {
  display: inline-block;
  padding: 12px 26px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;

  color: white;
  background: rgb(45,132,205);
  transition: all 0.25s ease;
}

.sx-news-archive-btn:hover {
  background: rgb(35,102,165);
  transform: translateY(-1px);
}

/* ==========================================
   SINGLE NEWS / EVENT PAGE
========================================== */
.sx-news-single {
  --sx-bg: #ffffff;
  --sx-text: #4a4a4a;
  --sx-heading: #1a1a1a;
  --sx-brand-blue: rgb(45, 132, 205);
  --sx-blue-light: rgba(45, 132, 205, 0.08);
  --sx-border: #eaeaea;

  max-width: 1200px;
  margin: 0 auto;
  padding: 50px 20px 0px;
  font-family: 'Helvetica Neue', Arial, sans-serif;
}

.sx-news-single-container {
  max-width: 920px;
  margin: 0 auto;
}

/* Back link */
.sx-news-back {
  display: inline-block;
  margin-bottom: 20px;
  color: #6c7a7a;
  text-decoration: none;
  font-size: 0.95rem;
  transition: color 0.25s ease;
}

.sx-news-back:hover {
  color: rgb(45, 132, 205);
}

/* ==========================================
   JOOMLA / ASTROID FULL ARTICLE IMAGE AS HERO
========================================== */
figure.sx-custom-img {
  max-width: 500px !important; /* Adjust size here (500px to 720px) */
  margin: 0 auto 34px auto !important;
  float: none !important; /* Overrides Joomla's default float */
  display: block;
  width: 100%;
}

/* 2. Style the image inside your custom figure */
figure.sx-custom-img img {
  width: 100% !important; 
  height: auto !important; /* Negates inline heights */
  display: block;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 10px;
  margin: 0 auto;
}

/* ==========================================
   CONTENT WRAP
========================================== */
.sx-news-single-content {
  max-width: 760px;
  margin: 0 auto;
}

/* Reuse news meta style cleanly */
.sx-news-single .sx-news-meta {
  display: flex;
  align-items: center;
  gap: 15px;
  flex-wrap: wrap;
  font-size: 0.85rem;
  font-family: 'Courier New', monospace;
  margin-bottom: 16px;
}

.sx-news-single .sx-news-tag {
  padding: 4px 10px;
  border-radius: 4px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.sx-news-single .tag-event {
  background: var(--sx-blue-light);
  color: var(--sx-brand-blue);
}

.sx-news-single .tag-release {
  background: rgba(46, 204, 113, 0.1);
  color: #27ae60;
}

.sx-news-single .tag-company {
  background: rgba(100, 100, 100, 0.1);
  color: #555;
}

.sx-news-single .sx-news-date {
  color: #888;
}

/* Title */
.sx-news-single-title {
  font-size: 2.4rem;
  line-height: 1.2;
  font-weight: 600;
  color: var(--sx-heading);
  margin: 0 0 22px 0;
}

/* Body */
.sx-news-single-body {
  color: var(--sx-text);
  font-size: 1.05rem;
  line-height: 1.8;
}

.sx-news-single-body p {
  margin: 0 0 22px 0;
}

.sx-news-single-body h2,
.sx-news-single-body h3 {
  color: var(--sx-heading);
  line-height: 1.3;
  margin: 38px 0 14px;
}

.sx-news-single-body a {
  color: var(--sx-brand-blue);
  text-decoration: none;
}

.sx-news-single-body a:hover {
  text-decoration: underline;
}

.sx-news-single-body ul,
.sx-news-single-body ol {
  margin: 0 0 22px 24px;
  line-height: 1.8;
}

.sx-news-single-body strong {
  color: var(--sx-heading);
}

/* Generic article images inside body */
.sx-news-single .item-page img,
.sx-news-single .sx-news-single-body img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
}

/* ==========================================
   MOBILE
========================================== */
@media (max-width: 768px) {
  .sx-news-single {
    padding: 36px 18px 60px;
  }

  .sx-news-single-title {
    font-size: 1.9rem;
  }

  .sx-news-single-body {
    font-size: 1rem;
    line-height: 1.75;
  }

  .sx-news-single .astroid-article-full-image {
    margin-bottom: 26px;
  }
}

/* ==========================================
   EVENT ARTICLE ENHANCEMENTS
========================================== */

/* Intro paragraph (editorial style) */
.sx-news-lede{
  font-size:1.15rem;
  line-height:1.7;
  color:#2c2c2c;
  margin-bottom:30px;
}

/* Event information card */
.sx-event-info{
  background:#f7fafc;
  border:1px solid #e6ecec;
  border-radius:8px;
  padding:22px 26px;
  margin:30px 0 36px 0;
}

.sx-event-row{
  display:flex;
  gap:20px;
  padding:8px 0;
  border-bottom:1px solid #eef2f3;
}

.sx-event-row:last-child{
  border-bottom:none;
}

.sx-event-label{
  font-weight:600;
  min-width:90px;
  color:#556;
  font-size:0.9rem;
}

.sx-event-value{
  color:#333;
  font-size:0.95rem;
}

/* ==========================================
   EDITORIAL TYPOGRAPHY IMPROVEMENT
========================================== */

.sx-news-single-body{
  font-size:1.08rem;
  line-height:1.85;
  color:#3a3a3a;
}

/* paragraphs */
.sx-news-single-body p{
  margin-bottom:24px;
}

/* better rhythm */
.sx-news-single-body p + p{
  margin-top:12px;
}

/* highlighted intro paragraph */
.sx-news-lede{
  font-size:1.2rem;
  line-height:1.75;
  color:#2a2a2a;
  margin-bottom:34px;
}

/* nicer emphasis */
.sx-news-single-body strong{
  color:#1a1a1a;
  font-weight:600;
}

/* nicer links */
.sx-news-single-body a{
  color:rgb(45,132,205);
  text-decoration:none;
  border-bottom:1px solid rgba(45,132,205,0.25);
  transition:all .2s ease;
}

.sx-news-single-body a:hover{
  border-bottom:1px solid rgb(45,132,205);
}

/* ==========================================
   SX ARCHIVE (1-COLUMN LIST LAYOUT - FIXED)
========================================== */
.sx-archive {
  --sx-bg: #ffffff;
  --sx-text: #4a4a4a;
  --sx-heading: #1a1a1a;
  --sx-brand-blue: rgb(45, 132, 205);
  --sx-blue-light: rgba(45, 132, 205, 0.08);
  --sx-border: #eaeaea;
}

section.sx-archive {
  max-width: 900px !important; 
  margin: 0 auto;
  padding: 40px 20px;
  font-family: 'Helvetica Neue', Arial, sans-serif;
}

/* Hide Leading Container just in case */
.sx-archive .items-leading { display: none !important; }

/* ------------------------------------------
   THE CARD WRAPPER (.blog-item)
------------------------------------------ */
/* This targets the outermost card */
.sx-archive .blog-item {
  background: var(--sx-bg);
  border: 1px solid var(--sx-border);
  border-radius: 6px;
  margin-bottom: 15px !important; 
  box-shadow: 0 4px 15px rgba(0,0,0,0.02);
  transition: box-shadow 0.3s ease, border-color 0.3s ease;
  overflow: hidden;
}

.sx-archive .blog-item:hover {
  box-shadow: 0 10px 30px rgba(0,0,0,0.05);
  border-color: rgba(45, 132, 205, 0.3);
}

/* ------------------------------------------
   THE FLEX LAYOUT (.item-content)
------------------------------------------ */
/* This is Astroid's inner wrapper. We force it to be a Left/Right row! */
.sx-archive .item-content {
  display: flex !important;
  flex-direction: row !important; 
  flex-wrap: nowrap !important; 
  align-items: center !important; 
}

/* ------------------------------------------
   THE IMAGE (Left Side - .item-image)
------------------------------------------ */
.sx-archive .item-image {
  width: 260px !important; 
  min-width: 260px !important; 
  max-width: 260px !important;
  flex: 0 0 260px !important;
  aspect-ratio: 16 / 9; 
  height: auto !important;
  margin: 0 !important;
  padding: 0 !important;
  float: none !important; /* Strips Astroid's native "left" class float */
}

/* Ensure the link wraps the whole height */
.sx-archive .item-image a {
  display: block;
  height: 100%;
}

.sx-archive .item-image img {
  width: 100% !important;
  height: auto !important;
  aspect-ratio: 16 / 9; 
  object-fit: cover !important;
  display: block !important;
  margin: 0 !important;
  border-radius: 6px !important;
}

/* ------------------------------------------
   THE TEXT EXCERPT (Right Side - .has-image)
------------------------------------------ */
/* Target Astroid's text wrapper container */
.sx-archive .has-image {
  flex: 1 1 auto !important; 
  min-width: 0 !important; 
  padding: 25px 30px !important;
  justify-content: center !important; /* Vertically center the text */
}

/* Typography Overrides */
.sx-archive .item-title {
  font-size: 1.3rem; 
  color: var(--sx-heading);
  margin: 10px 0 10px 0;
  font-weight: 600;
  line-height: 1.3;
}
.sx-archive .item-title a { color: inherit; text-decoration: none; transition: color 0.3s; }
.sx-archive .item-title a:hover { color: var(--sx-brand-blue); }

.sx-archive .article-intro-text p {
  color: var(--sx-text);
  font-size: 0.95rem;
  line-height: 1.6;
  margin: 0 0 15px 0;
}

/* Read More Link */
.sx-archive .readmore { margin-top: auto !important; padding: 0 !important; border: none !important; }
.sx-archive .readmore a {
  display: inline-block !important; color: var(--sx-brand-blue) !important;
  font-weight: 600 !important; font-size: 0.9rem !important;
  text-decoration: none !important; transition: opacity 0.3s ease !important;
}
.sx-archive .readmore a:hover { opacity: 0.7 !important; }

/* Meta Tags */
.sx-archive .sx-news-meta { display: flex; align-items: center; gap: 15px; font-size: 0.8rem; font-family: 'Courier New', monospace; margin-bottom: 5px; }
.sx-archive .sx-news-tag { padding: 3px 8px; border-radius: 4px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.sx-archive .tag-event { background: var(--sx-blue-light); color: var(--sx-brand-blue); }
.sx-archive .tag-release { background: rgba(46, 204, 113, 0.1); color: #27ae60; }
.sx-archive .tag-company { background: rgba(100, 100, 100, 0.1); color: #555; }
.sx-archive .sx-news-date { color: #888; }

/* ------------------------------------------
   MOBILE RESPONSIVENESS
------------------------------------------ */
@media (max-width: 768px) {
  .sx-archive .item-content {
    flex-direction: column !important; /* Stack cleanly on mobile */
  }
  .sx-archive .item-image {
    width: 100% !important;
    min-width: 100% !important;
    max-width: 100% !important;
    flex: 0 0 auto !important;
  }
  .sx-archive .item-image img {
    border-radius: 6px 6px 0 0 !important; /* Change border radius for top stacking */
  }
}


/* ==========================================
   ASTROID INTRO-TEXT OVERRIDE FIX
========================================== */

/* 1. Only hide the intro block when it is a direct sibling of the full article layout (.sx-news-single). 
      Because Joomla cuts off modules at the read-more line, .sx-news-single does not exist in modules,
      meaning your modules will NEVER be hidden! */
.sx-intro-block:has(~ .sx-news-single),
.sx-intro-block:has(+ .sx-news-single) {
  display: none !important;
}

/* 2. Bulletproof Safety Net: Explicitly force visibility inside all Joomla/Astroid modules and blog grids */
.module .sx-intro-block,
.moduletable .sx-intro-block,
.astroid-module .sx-intro-block,
.mod-custom .sx-intro-block,
.blog-item .sx-intro-block,
.items-row .sx-intro-block,
.items-leading .sx-intro-block {
  display: block !important;
}