/**
 * News Page Layout & Animations
 * Handles grid/list view layouts, card interactions, and responsive design
 */

/* Global Variables */

:root{
  --news-fade-duration: 0.8s;   
  --news-grid-gap: 30px;
}

/* ==========================================================================
   Layout Foundation
   ========================================================================== */

/* Main Container */
.news-container {
  width: 100%;
  margin: 5px 0;
  position: relative;
  clear: both;
  opacity: 0;
  transform: translateY(40px);
  transition: none;
}

/* Grid View Layout */
.news-container.grid-view {
  display: grid !important;
  grid-template-columns: repeat(3, 1fr) !important;
  gap: var(--news-grid-gap) !important;
  padding: 0 15px !important;           
  box-sizing: border-box;
}

/* List View Layout */
.news-container.list-view { display: block; }


/* ==========================================================================
   Grid Card Structure
   ========================================================================== */

/* News Item Size */
.news-container.grid-view .news-item {
  position: relative;
  aspect-ratio: 1 / 1.1;   
  min-height: 350px;       
  margin-bottom: 20px !important;
  box-sizing: border-box;
}

/* Card Container */
.news-container .news-card {
  width: 100% !important;
  height: 100%;
  background: transparent !important;
  border: none;
  overflow: visible;
  transition: .3s all;
}

/* Content Wrapper */
.news-container.grid-view .card-content { position: relative; width: 100%; height: 100%; }
.news-container.list-view .card-content { display: none !important; }


/* ==========================================================================
   Stack Container & Images
   ========================================================================== */

/* Stack Container */
.stack { position: relative; width: 100%; height: 100%; display: grid; }

/* Image Container */
.stack .news-image {
  grid-area: 1 / 1;
  width: 83% !important;            
  aspect-ratio: 5 / 4;
  overflow: hidden;
  border-radius: 5px;
  box-sizing: border-box;
  z-index: 1;
}

/* Image Element */
.stack .news-image img {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover;
  border-radius: 5px;
  border: none;
  box-shadow: 0 2px 12px rgba(0, 0, 0, .1);
  transition: transform .3s;
}
.stack .news-image:hover img { transform: scale(1.05); }


/* ==========================================================================
   Text Content Box
   ========================================================================== */

.stack .news-text {
  position: absolute;
  grid-area: 1 / 1;
  left: 8%;               
  bottom: 14%;             
  width: 94%;             
  padding: 15px 20px !important; 
  background: #fff;
  border-radius: 5px;
  box-shadow: 0 0 30px rgba(31, 45, 61, .13);
  box-sizing:border-box;

  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  transition: .3s all;
  z-index: 2;
}
.news-container .news-card:hover .news-text {
  background: #3a3973;
  color: #fff;
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(31, 45, 61, .25);
}


/* ==========================================================================
   Date Label
   ========================================================================== */

.news-container.grid-view .news-date-overlay {
  position: absolute;
  left: 0;
  top: 10px;
  padding: 8px 15px;
  background: #3a3973;
  color: #fff !important;
  font: 14px/1 "Open Sans", sans-serif;
  z-index: 10;
}


/* ==========================================================================
   Title, Summary & Read More
   ========================================================================== */

/* Title */
.stack .news-text h4 {
  font: 600 20px/1.3 "Muli", sans-serif; 
  margin: 0 0 8px !important;
  color: #2b2320;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}
.stack .news-text h4 a {
  color: inherit;
  text-decoration: none;
  transition: color .3s;
}
.stack .news-text h4 a:hover { color: #AF0E0E; }

.news-container .news-card:hover .news-text h4,
.news-container .news-card:hover .news-text h4 a { color: #fff !important; }

/* Summary */
.stack .news-text .news-summary {
  flex: 1;
  margin: 0 0 8px !important;
  font: 15px/1.4 "Open Sans", sans-serif;
  color: #4d4643;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
  overflow: hidden;
  white-space: normal;
}
.news-container .news-card:hover .news-summary { color: #fff !important; }

/* Read More Link */
.stack .news-text .read-more {
  margin-top: auto;
  font: 500 13px "Open Sans", sans-serif;
  color: #AF0E0E;
  text-decoration: none;
  transition: color .3s;
}
.stack .news-text .read-more:hover { color: #8B0B0B; text-decoration: underline; }
.news-container .news-card:hover .read-more { color: #fff !important; }


/* ==========================================================================
   List View Styles
   ========================================================================== */

.news-container.list-view{padding:0;margin:0;}
.news-container.list-view .news-item:last-child{border-bottom:none;}
.news-container.list-view .list-content{
  display:flex!important;align-items:center;gap:15px;
  padding:12px 15px;background:#fff;margin-bottom:2px;
  border:1px solid rgba(255,255,255,.8);border-radius:6px;transition:.3s;
}
.news-container.list-view .list-content:hover{
  background:#f5f5f5;border-color:#d9d9d9;
  transform:translateY(-1px);box-shadow:0 2px 8px rgba(0,0,0,.1);
}
.news-container.list-view .list-date{min-width:100px;font-size:13px;color:#666;white-space:nowrap;}
.news-container.list-view .list-title{flex:1;font-size:14px;color:#333;line-height:1.4;text-decoration:none;}
.news-container.list-view .list-title:hover{color:#AF0E0E;}
.news-controls .tab-btn.active,
.news-controls .view-btn.active{background:#AF0E0E!important;color:#fff!important;border:none!important;}
.news-controls .tab-btn:not(.active),
.news-controls .view-btn:not(.active){background:transparent!important;color:#65534c!important;border:none!important;}
.news-controls .tab-btn:hover:not(.active),
.news-controls .view-btn:hover:not(.active){background:#f6f3f2!important;color:#2b2320!important;}


/* ==========================================================================
   Background Colors
   ========================================================================== */

body       { background: #e6f2fa; }
#feature5{ background: #e6f2fa; }

/* ==========================================================================
   Responsive Design
   ========================================================================== */

/* Desktop: 3 columns */
@media (min-width: 1201px) {
  .news-container.grid-view { grid-template-columns: repeat(3, 1fr) !important; }
  .stack .news-text         { bottom: 14%; }
}

/* Tablet: 2 columns */
@media (max-width: 1200px) and (min-width: 901px) {
  .news-container.grid-view { grid-template-columns: repeat(2, 1fr) !important; gap: 25px; }
  .news-container.grid-view .news-item { min-height: 340px; }
  .stack .news-text { bottom: 20%; }
}

/* Small tablet: 1 column */
@media (max-width: 900px) and (min-width: 601px) {
  .news-container.grid-view { grid-template-columns: 1fr !important; gap: 22px; }
  .news-container.grid-view .news-item { min-height: 330px; }
  .stack .news-text { bottom: 30%; }
}

/* Mobile: 1 column */
@media (max-width: 600px) {
  .news-container.grid-view {
    grid-template-columns: 1fr !important;
    gap: 18px;
    padding: 0 6px;
  }
  .news-container.grid-view .news-item { min-height: 310px; }
  .stack .news-text { bottom: 20%; left: 5%; }
  .stack .news-text h4 { font-size: 17px; }
}


/* ==========================================================================
   Animations & States
   ========================================================================== */

/* Fade In Animation */
.news-container.news-fade-in {
  animation: newsPageFadeInUp var(--news-fade-duration) cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
  will-change: opacity, transform;   
  backface-visibility: hidden;
  perspective: 1000px;
}

/* Animation Keyframes */
@keyframes newsPageFadeInUp {
  0%   { opacity: 0;   transform: translateY(100px) translateZ(0); }
  20%  { opacity: .1;  transform: translateY(80px)  translateZ(0); }
  50%  { opacity: .6;  transform: translateY(30px)  translateZ(0); }
  80%  { opacity: .9;  transform: translateY(8px)   translateZ(0); }
  100% { opacity: 1;   transform: translateY(0)     translateZ(0); }
}

/* Category Switch States */
.news-container.switching {
  opacity: .3;
  transform: translateY(20px);
  transition: all var(--news-fade-duration) ease;
}

.news-container.switch-complete {
  opacity: 1;
  transform: translateY(0);
}

/* Initialization States */
.news-container.initialized {
  /* State marker only */
}

/* Prevent Flash */
.news-container:not(.initialized) {
  opacity: 0;
  transform: translateY(100px);
}

.news-container:not(.initialized) .news-item {
  opacity: 0;
  transform: translateY(60px);
}

/* Loading State */
.news-container.loading {
  opacity: .5;
  pointer-events: none;
}

/* Empty State */
.news-container:empty::after {
  content: 'No news available';
  display: block;
  text-align: center;
  color: #65534c;
  font: 16px "Open Sans", sans-serif;
  padding: 60px 20px;
}

/* Compatibility */
.cid .news-container {
  background: transparent;
}

.cid .news-container .news-card {
  position: relative;
  z-index: 1;
}


/* ==========================================================================
   Control Buttons
   ========================================================================== */

/* Control Container */
.news-controls{
  display:flex;flex-wrap:nowrap!important;gap:20px;align-items:center;
  width:100%;min-width:0;
  overflow-x:auto;overflow-y:hidden;white-space:nowrap;
  scrollbar-width:thin;
}

/* Category Tabs */
.news-tabs{
  display:flex;flex:0 0 auto;min-width:300px;
  border:1px solid #ccc;border-radius:6px;overflow:visible;background:#fff;position:relative;
}
.news-tabs .tab-btn{
  flex:1 1 0;min-width:80px;padding:8px 12px;
  font:14px/1.2 "Open Sans",sans-serif;background:transparent;color:#65534c;
  border:none;cursor:pointer;transition:.2s;text-align:center;white-space:nowrap;
  border-radius:0;position:relative;
}
.news-tabs .tab-btn:not(:last-child){border-right:1px solid #ccc;}
.news-tabs .tab-btn:first-child{border-radius:6px 0 0 6px;}
.news-tabs .tab-btn:last-child {border-radius:0 6px 6px 0;}

/* Active State */
.news-tabs .tab-btn.active::before{
  content:'';position:absolute;top:-1px;left:-1px;right:-1px;bottom:-1px;
  border:2px solid #AF0E0E;border-radius:inherit;pointer-events:none;z-index:10;
}
.news-tabs .tab-btn.active{background:#AF0E0E!important;color:#fff!important;z-index:5;}

/* View Toggle Buttons */
.view-toggle{
  display:flex;flex:0 0 auto;width:84px;min-width:84px;gap:0;
}
.view-toggle .view-btn{
  width:42px!important;height:42px!important;flex:0 0 42px;
  display:flex;align-items:center;justify-content:center;
  font-size:16px;background:#fff;color:#65534c;border:1px solid #ccc;
  cursor:pointer;transition:.2s;border-radius:0;box-sizing:border-box;position:relative;
}
.view-toggle .view-btn:first-child{border-radius:6px 0 0 6px;}
.view-toggle .view-btn:last-child {border-radius:0 6px 6px 0;}
.view-toggle .view-btn.active::before{
  content:'';position:absolute;top:-1px;left:-1px;right:-1px;bottom:-1px;
  border:2px solid #AF0E0E;border-radius:inherit;pointer-events:none;z-index:1;
}
.view-toggle .view-btn.active{background:#AF0E0E!important;color:#fff!important;}

/* Mobile Controls */
@media(max-width:768px){
  .news-controls{gap:15px;}
  .news-tabs{min-width:250px;}
  .news-tabs .tab-btn{font-size:13px;padding:6px 8px;min-width:70px;}
  .view-toggle .view-btn{font-size:14px;}
}


/* ==========================================================================
   Pagination Styles
   ========================================================================== */

.news-pagination {
  margin: 20px 0 0;
  text-align: center;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
}

/* List View Pagination Spacing */
.news-container.list-view ~ .news-pagination {
  margin: 50px 0 0;    
}

/* Grid View Pagination Spacing */
.news-container.grid-view ~ .news-pagination {
  margin: 20px 0 0px;    
}

.news-pagination button {
  background: #fff;
  border: 1px solid #dee2e6;
  color: #65534c;
  padding: 8px 12px;
  cursor: pointer;
  border-radius: 4px;
  font: 14px "Open Sans", sans-serif;
  transition: all .2s ease;
  min-width: 40px;
}

.news-pagination button:hover {
  background: #f8f9fa;
  border-color: #adb5bd;
  color: #495057;
}

.news-pagination button.active {
  background: #AF0E0E !important;
  color: #fff !important;
  border-color: #AF0E0E !important;
}

.news-pagination button:disabled {
  background: #f8f9fa;
  color: #6c757d;
  border-color: #dee2e6;
  cursor: not-allowed;
  opacity: 0.6;
}

@media (max-width: 768px) {
  .news-pagination button {
    padding: 6px 10px;
    font-size: 13px;
    min-width: 36px;
  }
}

/* =================================  End of File  ================================ */

