/* === visual_harmony.css ===
   LMS Celebrity Autographs v1.4.1
   Milestone 3 – Section 4: Responsive Design & Mobile Optimisation
   Final layout polish – spacing, rhythm, and balance.
*/

/* --- Global rhythm --- */
html,
body {
  scroll-behavior: smooth;
  letter-spacing: 0.02em;
  line-height: 1.5;
  background-color: #fff;
}

/* --- Headers & brand consistency --- */
h1,
h2,
h3 {
  color: #2C146C;
  margin-top: 1.2em;
  margin-bottom: 0.4em;
  font-weight: 600;
}

h1 {
  font-size: clamp(1.4rem, 2vw + 0.8rem, 2.2rem);
}

h2 {
  font-size: clamp(1.2rem, 1.5vw + 0.6rem, 1.8rem);
}

h3 {
  font-size: clamp(1.1rem, 1.2vw + 0.4rem, 1.4rem);
}

/* --- Paragraph and general content spacing --- */
p,
td,
th {
  margin: 0.5em 0;
  line-height: 1.5;
}

/* --- Table spacing refinement --- */
table {
  border-spacing: 0;
  border-collapse: collapse;
}

th,
td {
  padding: 10px 8px;
  vertical-align: middle;
}

th {
  font-weight: 600;
  background-color: #2C146C;
  color: white;
}

tr:nth-child(even) {
  background-color: #f7f7fa;
}

/* --- Buttons & touch targets --- */
button {
  font-family: inherit;
  font-weight: 500;
  letter-spacing: 0.02em;
  transition: background-color 0.2s ease, transform 0.1s ease;
}

button:hover {
  transform: translateY(-1px);
}

/* --- Pagination and footer breathing room --- */
.pagination-bar {
  margin-top: 16px;
  margin-bottom: 24px;
  gap: 8px;
}

/* --- Modal adjustments for consistent look --- */
.modal {
  padding: 16px;
  border-radius: 12px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.15);
}

.carousel-slide {
  transition: opacity 0.6s ease;
  opacity: 0;
  position: absolute;
  top: 0;
  left: 0;
}

.carousel-slide[style*="display: block"] {
  opacity: 1;
  position: relative;
}


/* --- Mobile fine-tuning --- */
@media (max-width: 768px) {
  body {
    line-height: 1.45;
    letter-spacing: 0.015em;
  }

  th,
  td {
    padding: 8px 6px;
  }

  button {
    font-size: 0.95rem;
  }
}



th {
  position: relative;
  user-select: none;
}

th[aria-sort]::after {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.8em;
  color: var(--brand-main);
}

th[aria-sort="ascending"]::after {
  content: "▲";
}

th[aria-sort="descending"]::after {
  content: "▼";
}

/* === LMS Catalogue Table Header Polish === */
table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  font-family: 'Segoe UI', sans-serif;
}

th {
  background-color: var(--brand-main, #2C146C);
  color: #fff;
  font-weight: 600;
  padding: 10px 14px;
  text-align: left;
  position: relative;
  user-select: none;
  transition: background-color 0.25s ease;
}

th:hover {
  background-color: #3b1b8f;
}

th[aria-sort="ascending"]::after,
th[aria-sort="descending"]::after {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.8em;
  color: var(--brand-accent, #D4AF37);
}

th[aria-sort="ascending"]::after {
  content: "▲";
}

th[aria-sort="descending"]::after {
  content: "▼";
}

td {
  padding: 8px 14px;
  border-bottom: 1px solid #eee;
}

tr:hover td {
  background-color: #f8f5ff;
}

.highlight {
  background: rgba(212, 175, 55, 0.2);
  border-radius: 3px;
  padding: 1px 3px;
}

/* === LMS Details Page Grid Styling === */
.detail-card {
  background: #fff;
  border-radius: 12px;
  padding: 30px;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
  max-width: 850px;
  margin: 30px auto;
  font-family: 'Segoe UI', sans-serif;
}

.detail-card h2 {
  text-align: center;
  color: var(--brand-main, #2C146C);
  margin-bottom: 10px;
}

.detail-card hr {
  border: 1px solid var(--brand-accent, #D4AF37);
  width: 80%;
  margin: 10px auto 25px auto;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: 40px;
  row-gap: 10px;
  align-items: start;
  justify-content: center;
  max-width: 700px;
  margin: 0 auto;
  font-size: 0.95em;
}

.detail-grid p {
  margin: 4px 0;
}

.detail-grid strong {
  color: var(--brand-main, #2C146C);
}

/* Highlight Imperfections on Details Page */
.detail-grid .imperfection-highlight {
  color: #b22222;
  font-weight: bold;
  background: rgba(255, 0, 0, 0.08);
  padding: 2px 4px;
  border-radius: 4px;
}

/* Buttons */
.detail-buttons {
  text-align: center;
  margin-top: 30px;
}

.detail-buttons button {
  background: var(--brand-main, #2C146C);
  color: #fff;
  border: none;
  padding: 12px 24px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1em;
  transition: background 0.25s ease;
}

.detail-buttons button:hover {
  background: #3b1b8f;
}

.detail-buttons button.secondary {
  background: #eee;
  color: #333;
}

.detail-buttons button.secondary:hover {
  background: #ddd;
}

/* === LMS: Amazon-Style Landscape Carousel === */
.detail-carousel {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  width: 100%;
  max-width: 640px;        /* Amazon-like landscape frame */
  aspect-ratio: 4 / 3;     /* responsive 4:3 ratio */
  margin: 0 auto 40px;
  overflow: hidden;
}

.detail-carousel img.carousel-slide {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;      /* show entire autograph image */
  background-color: #fafafa;
  border-radius: 8px;
  opacity: 0;
  transition: opacity 0.8s ease-in-out;
}

.detail-carousel img.carousel-slide.active {
  opacity: 1;
  z-index: 1;
}

/* Navigation buttons */
.detail-carousel .carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.4);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  cursor: pointer;
  font-size: 1.5em;
  line-height: 1em;
  z-index: 2;
  transition: background 0.3s;
}
.detail-carousel .carousel-btn:hover {
  background: rgba(0, 0, 0, 0.6);
}
.detail-carousel .carousel-btn.prev { left: 10px; }
.detail-carousel .carousel-btn.next { right: 10px; }


/* === Highlighting for matched filter terms === */
.highlight {
  background: rgba(212, 175,55, 1);
  font-weight: bold;
  border-radius: 3px;
  transition: background 0.2s ease;
}

#recently-viewed {
  margin: 40px auto;
  text-align: center;
  background: #fff;
  padding: 20px;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

#recently-viewed h3 {
  color: var(--brand-main, #2C146C);
  margin-bottom: 15px;
}

.recently-tray {
  display: flex;
  overflow-x: auto;
  gap: 15px;
  padding: 10px;
  justify-content: center;
  scroll-behavior: smooth;
}

.recent-card {
  min-width: 140px;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

.recent-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}

.recent-card img {
  width: 100%;
  height: 160px;
  object-fit: contain;
  border-radius: 6px 6px 0 0;
  background: #fff;
}

.recent-card p {
  margin: 8px 0;
  font-size: 0.85em;
  color: #333;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
}

.clear-btn {
  background:#b22222;
  color:#fff;
  border:none;
  padding:6px 12px;
  border-radius:6px;
  cursor:pointer;
  font-weight:500;
  font-family:'Poppins',sans-serif;
  transition:background 0.3s;
}
.clear-btn:hover {
  background:#d94444;
}


/* Fade-in animation for smoother appearance */
@keyframes fadeInImage {
  from { opacity: 0; transform: scale(1.02); }
  to   { opacity: 1; transform: scale(1); }
}
.detail-carousel img.active {
  animation: fadeInImage 0.6s ease;
}

/* Slightly adaptive height for smaller screens */
@media (max-width: 768px) {
  .detail-carousel {
    max-width: 90%;
    aspect-ratio: 4 / 3;
  }
}



/* smooth repositioning on load */
@keyframes fadeInImage {
  from { opacity: 0; transform: translateY(15px); }
  to   { opacity: 1; transform: translateY(0); }
}
.detail-carousel img.active {
  animation: fadeInImage 0.6s ease;
}
