/* ============================================================
   COMPONENTS LAYER
   - reusable UI elements
   - cards, buttons, badges, forms, navbars, etc.
============================================================ */
    /* =============================================
   CARD COMPONENT STYLES
   ============================================= */

/* ====================
   BASE CARD
   ==================== */

/* Basic card container with padding, border, and background */
.d-card {
  background: var(--cfsurface-light);
  padding: var(--cf-p-m);
  position: relative;
  border: 1px solid var(--cf-border-light);
  border-radius: 12px;
  overflow: hidden;
  align-items: flex-start;
}

/* Inner flex container for card content */
.d-card-inner-flex {
  display: flex;
  flex-direction: column;
    gap:var(--cf-stack-sm);
  height: 100%;
}
/* ====================
   CARD VARIANTS
   ==================== */

/* Compact card variant for flex layouts */
.d-flex__card--compact {
  flex-basis: 240px;
  flex-grow: 1;
  align-items: center;
  align-self: stretch;
}

@media (max-width: 767px) {
  .d-flex__card--compact {
    flex-basis: 80vw;
  }
}

/* Elevated card with shadow and background */
.d-card--elevated {
  box-shadow: var(--cf-shadow-md);
  background-color: var(--cfelevated-light);
}

/* Card with subtle shadow effect */
.d-card-shadow {
  box-shadow: 0 4px 12px 0 var(--cfbg-dark-10);
  transition: all 0.2s ease-in-out;
}

/* ====================
   CARD INTERACTIONS
   ==================== */

/* Hover effects for cards */
.d-card-hover {
  transition: all var(--cf-anim-speed) var(--cf-anim-ease);
}

.d-card-hover:hover {
  transform: translateY(-5px); /* Subtle lift of 5px */
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1); /* Professional depth shadow */
}

/* Clickable card with full coverage link area */
.d-card--clickable {
  position: relative;
}

.d-card--clickable .d-card__heading a::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  right: 0;
  left: 0;
  z-index: 100;
}

/* ====================
   CARD CONTENT ELEMENTS
   ==================== */

/* Card heading styles */
.d-card__heading {
  font-size: var(--cf-type-h4);
}

/* Card excerpt with line clamping (3 lines max) */
.d-card__excerpt {
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  text-overflow: ellipsis;
}

/* CTA button styling */
.d-card__cta {
  font-weight: 600;
  text-transform: uppercase;
}

/* Highlighted CTA with background effect */
.d-card__cta--highlight {
  position: relative;
  z-index: 10;
}

.d-card__cta--highlight::after {
  content: '';
  position: absolute;
  background: var(--cfprimary);
  height: 40%;
  width: 100%;
  top: 50%;
  bottom: -40%;
  left: 0;
  z-index: -1;
}

/* Card accent border/background effect */
.d-card__accent {
  position: absolute;
  top: -10px;
  left: -10px;
  right: -10px;
  bottom: -10px;
  background: linear-gradient(45deg, var(--cfprimary-5), var(--cfsecondary-5));
  border-radius: var(--cf-radius-lg);
  z-index: -1;
  opacity: 0;
  transition: opacity var(--cf-anim-speed) var(--cf-anim-ease);
}

/* Card overlay for gradient effects */
d-card__overlay{
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    to bottom,
    transparent 0%,
    var(--cfbg-dark-90) 100%
  );
  opacity: 0;
  transition: opacity var(--cf-anim-speed) var(--cf-anim-ease);
  pointer-events: none;
}

/* =============================================
   SPLIT CARD LAYOUT (Alternating Desktop Layout)
   ============================================= */

/* Main split card container */
.d-card--split {
  position: relative;
  /* The layout must be a flex container for 'order' to work */
  display: flex;
  flex-direction: column; /* Force vertical stacking on mobile */
  column-gap: var(--cf-grid-gap);
}

/* Media element in split card (always first on mobile) */
.d-card--split__media {
  position: relative;
  order: -1; /* Image always first on mobile stack */
  /* --- CRITICAL: FLOATING IMAGE EFFECT --- */
  z-index: 10;
  display: block;
  width: 100%;
}

/* Asymmetrical background highlight for odd cards (default: left bleed) */
.d-card--split__media::after {
  content: '';
  position: absolute;
  background: var(--cfprimary-20); /* ODD card default color */
  z-index: -1;
  
  /* --- 3-SIDE EXPOSURE (TOP/BOTTOM BLEED) --- */
  top: -15px;
  bottom: -15px;
  height: calc(100% + 30px);
  
  /* --- ODD CARD DEFAULT (LEFT BLEED) --- */
  left: -20vw; /* Bleeds to viewport left edge */
  right: 50%; /* Stops at the center of the media element */
}

/* Even card background flip - different color and right bleed */
.d-card--split:nth-child(even) .d-card--split__media::after {
  background: var(--cfaccent-10); /* EVEN card's color */
  /* --- EVEN CARD RIGHT BLEED --- */
  left: 50%; /* Starts at the center of the media element */
  right: -20vw; /* Bleeds to viewport right edge */
}

/* Split card image styling */
.d-card--split__image {
  object-fit: cover;
  height: 100%;
  aspect-ratio: 4/3;
}

/* Split card content container */
.d-card--split__content {
  flex-direction: column;
  flex-grow: 1;
  row-gap: var(--cf-stack-md);
  flex-basis: 40%;
}

/* Split card heading */
.d-card--split__heading {
  font-size: var(--cf-type-h3);
}

/* Split card CTA button */
.d-card--split__cta {
  max-width: 300px;
  background: #ffffff;
  border: 1px solid var(--cfprimary);
}

/* ====================
   TABLET/DESKTOP ALTERNATION (768px+)
   ==================== */

@media (min-width: 768px) {
  /* Horizontal layout for desktop */
  .d-card--split {
    flex-direction: row;
    /* Remove vertical gap for desktop layout */
  }

  /* ODD cards keep the image on the left (default order -1) */
  .d-card--split__media {
    order: -1;
  }

  /* --- EVEN CARD LAYOUT FLIP (order + text alignment) --- */

  /* Flips the media element to the right column */
  .d-card--split:nth-child(even) .d-card--split__media {
    order: 1;
  }

  /* Flips content alignment to match the image position */
  .d-card--split:nth-child(even) .d-card--split__content {
    align-items: flex-end; /* If using Flex/Grid */
    text-align: right;
  }
}

/* =============================================
   SHOWCASE CARD (Featured/Hero Card)
   ============================================= */

/* Main showcase card container with hover effects */
.d-card--showcase {
  position: relative;
  cursor: pointer;
}

.d-card--showcase:hover .d-card--showcase__image-wrapper {
  transform: translateY(-12px) scale(1.02);
  box-shadow: 
    var(--cf-shadow-xl),
    0 0 0 1px var(--cfprimary-20);
}

.d-card--showcase:hover .d-card--showcase__image {
  transform: scale(1.08);
}

.d-card--showcase:hover .d-card--showcase__content {
  transform: translateY(0);
  opacity: 1;
}

.d-card--showcase:hover .d-card__accent {
  opacity: 1;
}

/* Showcase image wrapper */
.d-card--showcase__image-wrapper {
  position: relative;
  border-radius: var(--cf-radius-lg);
  overflow: hidden;
  box-shadow: 
    var(--cf-shadow-lg),
    0 0 0 1px var(--cfborder-light);
  transition: all var(--cf-anim-speed) var(--cf-anim-ease);
  background: var(--cfsurface-light);
  aspect-ratio: 4/3;
}

/* Showcase image */
.d-card--showcase__image {
  width: 100%;
  height: auto;
  aspect-ratio: 16/9;
  object-fit: cover;
  transition: transform var(--cf-anim-speed) var(--cf-anim-ease);
}

/* Showcase content overlay */
.d-card--showcase__content {
  position: absolute;
  bottom: var(--cf-space-xl);
  left: var(--cf-space-xl);
  right: var(--cf-space-xl);
  padding: var(--cf-p-lg);
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--cf-radius-lg);
  box-shadow: 
    0 8px 32px rgba(0, 0, 0, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  transform: translateY(20px);
  opacity: 0;
  transition: all var(--cf-anim-speed) var(--cf-anim-ease);
}

/* Showcase title */
.d-card--showcase__title {
  font-size: var(--cf-type-h3);
  color: var(--cftext-light);
  margin-bottom: var(--cf-space-xs);
  font-weight: 600;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Showcase link */
.d-card--showcase__link {
  display: inline-flex;
  align-items: center;
  gap: var(--cf-space-xs);
  color: var(--cfprimary);
  text-decoration: none;
  font-weight: 500;
  padding: var(--cf-p-xs) 0;
  border-bottom: 1px solid transparent;
  transition: all var(--cf-anim-speed) var(--cf-anim-ease);
  text-transform: uppercase;
  font-size: var(--cf-type-h5);
}

.d-card--showcase__link:hover {
  border-bottom-color: var(--cfprimary);
  gap: var(--cf-space-sm);
}

.d-card--showcase__link::after {
  content: '→';
  transition: transform var(--cf-anim-speed) var(--cf-anim-ease);
}

.d-card--showcase__link:hover::after {
  transform: translateX(4px);
}

/* ====================
   MISSING/MISMATCHED CLASSES FROM JSON
   ==================== */

/* Note: The following classes exist in JSON but have different settings than what's in CSS */

/* d-card--split has additional properties not in CSS: 
   _alignItems: "center", 
   _alignSelf: "stretch", 
   _justifyContent: "space-between",
   _gridTemplateColumns: "1fr 1fr"
   These are NOT in the _cssCustom, so they should be added separately */

/* Corrected d-card--split with all properties */
.d-card--split {
  align-items: center;
  align-self: stretch;
  justify-content: space-between;
  display: flex;
  grid-template-columns: 1fr 1fr;
  position: relative;
  flex-direction: column; /* Force vertical stacking on mobile */
  column-gap: var(--cf-grid-gap);
}

/* d-card--split__media has _order:mobile_portrait: "-1" - this should be handled by responsive design */

/* d-card--split__content has _flexGrow:mobile_portrait: "1" - this should be responsive */
@media (max-width: 767px) {
  .d-card--split__content {
    flex-grow: 1;
  }
}


/* d-content-wrapper has _direction: "column" */
.d-content-wrapper {
  flex-direction: column;
}
