/*
 * Oto Tuan – Frontend Readmore Styles
 * Phase 4B | scoped to .ott-readmore-* classes only
 * Mobile-first. Brand primary: #e31d1a (red).
 */

/* ── Variables ──────────────────────────────────────────────────── */
.ott-readmore-wrapper {
  --ott-readmore-red:       #c71117;
  --ott-readmore-red-dark:  #8f0b10;
  --ott-readmore-white:     #ffffff;
  --ott-readmore-gray:      #666666;
  --ott-readmore-border:    #bfbfbf;
  --ott-readmore-product-h:  300px;
  --ott-readmore-category-h: 150px;
  --ott-readmore-transition: max-height 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);

  position: relative;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 20px;
}

/* ── Content Container ───────────────────────────────────────────── */
.ott-readmore-content {
  overflow: hidden;
  position: relative;
  width: 100%;
  transition: var(--ott-readmore-transition);
}

/* Specific heights when collapsed */
.ott-readmore--product .ott-readmore-content {
  max-height: var(--ott-readmore-product-h);
}

.ott-readmore--category .ott-readmore-content {
  max-height: var(--ott-readmore-category-h);
}

/* Expanded state (JS-controlled style fallback) */
.ott-readmore-wrapper.is-expanded .ott-readmore-content {
  max-height: 9999px; /* Fallback if inline styling fails */
}

/* ── Subtle Fade Gradient Overlay ────────────────────────────────── */
.ott-readmore-content::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 1) 100%);
  pointer-events: none;
  opacity: 1;
  transition: opacity 0.2s ease;
}

/* Hide gradient when expanded */
.ott-readmore-wrapper.is-expanded .ott-readmore-content::after {
  opacity: 0;
}

/* ── Toggle Button ───────────────────────────────────────────────── */
.ott-readmore-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 8px 32px;
  margin: 15px auto 5px;
  background: var(--ott-readmore-white);
  color: var(--ott-readmore-red);
  border: 1px solid var(--ott-readmore-red);
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
  line-height: 1;
  text-decoration: none;
}

.ott-readmore-toggle:hover {
  background: var(--ott-readmore-red);
  color: var(--ott-readmore-white);
  box-shadow: 0 4px 12px rgba(199, 17, 23, 0.15);
}

.ott-readmore-toggle:focus-visible {
  outline: 3px solid rgba(199, 17, 23, 0.4);
  outline-offset: 2px;
}

.ott-readmore-toggle:active {
  transform: scale(0.98);
}

/* Chevron indicator */
.ott-readmore-toggle .ott-chevron {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  transition: transform 0.25s ease;
  margin-left: 8px;
  vertical-align: middle;
  margin-top: -3px;
}

.ott-readmore-wrapper.is-expanded .ott-readmore-toggle .ott-chevron {
  transform: rotate(-135deg);
  margin-top: 2px;
}

/* ── Image scaling protection inside descriptions ────────────────── */
.ott-readmore-content img {
  max-width: 100%;
  height: auto;
  object-fit: contain;
}

/* ── Reduced Motion ──────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .ott-readmore-content {
    transition: none;
  }
  .ott-readmore-toggle,
  .ott-readmore-toggle .ott-chevron {
    transition: none;
  }
}
