/* All styles isolated with the loop_ prefix */
.loop_carousel {
  --loop-gap: 30px;
  --loop-radius: 16px;
  --loop-shadow: 0 4px 18px rgba(0,0,0,.08);
  --loop-border: 1px solid rgba(0,0,0,.06);
  --loop-brand: #4285F4;
  position: relative;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.loop_carousel a:focus {
    outline: 2px solid transparent;
    outline-offset: 2px;
}

/* Track wrapper - this clips the overflow horizontally only */
.loop_carousel__viewport { 
  overflow-x: hidden; /* Only hide horizontal overflow */
  overflow-y: visible; /* Allow vertical expansion */
  position: relative;
  width: 100%; 
  max-width: 100%;
  box-sizing: border-box;
  outline: none; 
  padding:0 3rem;
}
.loop_carousel__track {
  display: flex;
  gap: var(--loop-gap);
  transition: transform 450ms ease-in-out;
  will-change: transform;
  flex-wrap: nowrap;
  /* Constrained width - 4 items + 3 gaps, matching slide width */
  width: calc(4 * 275px + 3 * var(--loop-gap));
}

/* Responsive track widths */
@media (max-width: 1023px) {
  .loop_carousel__track {
    width: calc(3 * 275px + 2 * var(--loop-gap));
  }
}

@media (max-width: 767px) {
  .loop_carousel__track {
    width: calc(2 * 275px + 1 * var(--loop-gap));
  }
}

@media (max-width: 479px) {
  .loop_carousel__track {
    width: calc(1 * 275px);
  }
}

/* Each slide - fixed width like carousel module */
.loop_carousel__slide { 
  flex: 0 0 275px;
  width: 275px;
  box-sizing: border-box;
}

/* Card (your existing inner markup/classes are fine) */
.loop_card {
  background: #f4f4f4; 
  border-radius: var(--loop-radius); 
  box-shadow: var(--loop-shadow);
  border: var(--loop-border); 
  padding: 16px; 
  min-height: 200px; /* Use min-height instead of height: 100% */
  display: flex;
  flex-direction: column;
}
.loop_card__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.loop_card__author { display: flex; align-items: center; gap: 12px; }
.loop_card__avatar { 
  border-radius: 50%; 
  width: 40px; 
  height: 40px; 
  object-fit: cover; 
  display: block;
  flex-shrink: 0; /* Prevent shrinking */
  background-color: #f3f4f6; /* Fallback background */
  border: 1px solid #e5e7eb; /* Subtle border */
}
.loop_card__meta { line-height: 1.2; }
.loop_card__name { display: block; font-weight: 600; font-size: 14px; color: #111827;}
.loop_card__time { display: block; font-size: 12px; color: #6b7280; }
.loop_card__brand { 
  width: 28px; 
  height: 28px; 
  border-radius: 50%; 
  display: inline-grid; 
  place-items: center; 
  background: #ffffff; 
  border: 1px solid #e5e7eb;
  padding: 4px;
  box-sizing: border-box;
}
.loop_card__rating {
  margin: 10px 0 0;
  flex-shrink: 0; /* Keep rating fixed */
  text-align: left;
}
.loop_card__text { 
  margin: 6px 0 0; 
  font-size: 14px; 
  color: #111827; 
  line-height: 1.5;
  overflow-wrap: break-word; /* Handle long words */
  hyphens: auto; /* Allow hyphenation for better text flow */
  flex-grow: 1; /* Allow text area to expand */
  transition: all 0.3s ease; /* Smooth transition for text changes */
  text-align: left;
}

.loop_card__head,
.loop_card__rating {
  flex-shrink: 0; /* Keep header and rating fixed */
}

.loop_card__text-preview,
.loop_card__text-full {
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1); /* Smooth ease-in-out transition */
}

.loop_card__read-more,
.loop_card__read-less {
  color: #000000;
  text-decoration: none;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.2s ease;
  position: relative;
  z-index: 10;
  pointer-events: auto;
}

.loop_card__read-less {
  margin-top:8px;
  display:block;
}

.loop_card__read-more:hover,
.loop_card__read-less:hover {
  color: #040b1f;
  text-decoration: underline;
}

.loop_card__text-full {
  display: none;
}

/* Nav - positioned within viewport bounds like carousel module */
.loop_carousel__nav { 
  position: absolute; 
  top: 50%; /* Fixed position from top instead of using inset */
  left: 0;
  right: 0;
  height: 200px; /* Fixed height for button positioning */
  pointer-events: none; 
  z-index: 1; 
}
.loop_carousel__btn {
  position: absolute; 
  top: 50%; 
  transform: translateY(-50%);
  pointer-events: auto; 
  width: 40px; 
  height: 40px; 
  border-radius: 999px;
  border: 0; 
  background: rgba(0,0,0,.7); 
  color: #fff; 
  font-size: 18px;
  display: grid; 
  place-items: center; 
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
}
.loop_carousel__btn--prev { left: 10px; }
.loop_carousel__btn--next { right: 10px; }
.loop_carousel__btn:focus-visible { outline: 2px solid var(--loop-brand); outline-offset: 2px; }
.loop_carousel__btn.is-disabled { opacity: .35; cursor: not-allowed; }

/* Dots (optional) */
.loop_carousel__dots { display: flex; gap: 6px; justify-content: center; margin-top: 12px; }
.loop_carousel__dots button { width: 14px; height: 14px; border-radius: 50%; border: 0; border: 1px solid white; background: #d1d5db; cursor: pointer; transition: all 0.2s ease; }
.loop_carousel__dots button[aria-current="true"] { background: var(--loop-brand); }

/* Google colors for dots - cheeky coolness! */
.loop_carousel__dots button:nth-child(1) { background: #4285F4; } /* Google Blue */
.loop_carousel__dots button:nth-child(2) { background: #EA4335; } /* Google Red */
.loop_carousel__dots button:nth-child(3) { background: #FBBC05; } /* Google Yellow */
.loop_carousel__dots button:nth-child(4) { background: #34A853; } /* Google Green */
.loop_carousel__dots button:nth-child(5) { background: #4285F4; } /* Back to Blue */
.loop_carousel__dots button:nth-child(6) { background: #EA4335; } /* Back to Red */
.loop_carousel__dots button:nth-child(7) { background: #FBBC05; } /* Back to Yellow */
.loop_carousel__dots button:nth-child(8) { background: #34A853; } /* Back to Green */
.loop_carousel__dots button:nth-child(9) { background: #4285F4; } /* Back to Blue */
.loop_carousel__dots button:nth-child(10) { background: #EA4335; } /* Back to Red */
.loop_carousel__dots button:nth-child(11) { background: #FBBC05; } /* Back to Yellow */
.loop_carousel__dots button:nth-child(12) { background: #34A853; } /* Back to Green */

/* Active dot gets a slight glow effect */
.loop_carousel__dots button[aria-current="true"] { 
  box-shadow: 0 0 8px rgba(0,0,0,0.3);
  transform: scale(1.2);
}

/* Link button underneath carousel */
.loop_carousel__link-button {
  text-align: center;
  margin-top: 20px!important;
  margin-bottom: 20px!important;
}

.loop_google_button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: #ffffff;
  color: #3c4043;
  text-decoration: none;
  border: 1px solid #dadce0;
  border-radius: 4px;
  font-family: 'Google Sans', Roboto, Arial, sans-serif;
  font-size: 16px;
  font-weight: 500;
  transition: all 0.2s ease;
  box-shadow: 0 1px 2px 0 rgba(60,64,67,.3), 0 1px 3px 1px rgba(60,64,67,.15);
  color: #111827;
}

.loop_google_button .view-all {
  color: #111827;
}

.loop_google_button:hover {
  background: #f8f9fa;
  border-color: #dadce0;
  box-shadow: 0 1px 3px 0 rgba(60,64,67,.3), 0 4px 8px 3px rgba(60,64,67,.15);
  color: #3c4043;
  text-decoration: none;
}

.loop_google_button__icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.loop_google_button svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: #111827;
}


/* Rating summary */
.loop_summary {
  display: flex; 
  align-items: center; 
  justify-content: center;
  padding: 20px 0; 
  margin-bottom: 20px;
}

.loop_summary__info { 
  display: flex; 
  align-items: center; 
  justify-content: center; 
  text-align: center; 
  gap: 0.75rem;
  flex-wrap: wrap;
}

.loop_summary__stars {
  display: flex;
  align-items: center;
  gap: 2px;
}

.loop_summary__stars svg { 
  width: 20px; 
  height: 20px; 
  display: block;
}

.loop_summary__meta { 
  font-size: 16px; 
  color: #2a2c31; 
  font-weight: 500;
}

.loop_summary__brand { 
  display: flex;
  align-items: center;
}

.loop_summary__brand svg { 
  height: 24px; 
  display: block;
}

/* Mobile responsive layout - break elements to new lines */
@media (max-width: 768px) {
  .loop_summary__info {
    flex-direction: column;
    gap: 0.5rem;
  }
  
  .loop_summary__info .break {
    order: 1;
  }
  
  .loop_summary__stars {
    order: 0;
  }
}
