/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

/* Lightbox Gallery Styles */
.lightbox-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background-color: rgba(0, 0, 0, 0);
  backdrop-filter: blur(0);
  transition: background-color 0.3s ease, backdrop-filter 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-overlay.lightbox-visible {
  background-color: rgba(0, 0, 0, 0.95);
  backdrop-filter: blur(8px);
}

.lightbox-container {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 10;
  color: white;
  opacity: 0.7;
  transition: opacity 0.2s, transform 0.2s;
  padding: 0.5rem;
  border-radius: 9999px;
  background-color: rgba(255, 255, 255, 0.1);
}

.lightbox-close:hover {
  opacity: 1;
  transform: scale(1.1);
  background-color: rgba(255, 255, 255, 0.2);
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  color: white;
  opacity: 0.7;
  transition: opacity 0.2s, transform 0.2s;
  padding: 1rem;
  border-radius: 9999px;
  background-color: rgba(255, 255, 255, 0.1);
}

.lightbox-nav:hover {
  opacity: 1;
  background-color: rgba(255, 255, 255, 0.2);
}

.lightbox-prev {
  left: 1rem;
}

.lightbox-prev:hover {
  transform: translateY(-50%) translateX(-4px);
}

.lightbox-next {
  right: 1rem;
}

.lightbox-next:hover {
  transform: translateY(-50%) translateX(4px);
}

.lightbox-content {
  position: relative;
  max-width: 90vw;
  max-height: 80vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-spinner {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-image {
  max-width: 90vw;
  max-height: 80vh;
  object-fit: contain;
  border-radius: 0.5rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  transition: opacity 0.3s ease;
}

.lightbox-footer {
  position: absolute;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.lightbox-counter {
  color: white;
  font-size: 0.875rem;
  font-weight: 500;
  background-color: rgba(0, 0, 0, 0.5);
  padding: 0.375rem 1rem;
  border-radius: 9999px;
}

.lightbox-thumbnails {
  display: flex;
  gap: 0.5rem;
  padding: 0.5rem;
  background-color: rgba(0, 0, 0, 0.5);
  border-radius: 0.75rem;
  max-width: 90vw;
  overflow-x: auto;
}

.lightbox-thumbnail {
  flex-shrink: 0;
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 0.5rem;
  overflow: hidden;
  opacity: 0.5;
  transition: opacity 0.2s, transform 0.2s, box-shadow 0.2s;
  border: 2px solid transparent;
}

.lightbox-thumbnail:hover {
  opacity: 0.8;
  transform: scale(1.05);
}

.lightbox-thumbnail.active {
  opacity: 1;
  border-color: white;
  box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.5);
}

.lightbox-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Hide thumbnails on very small screens */
@media (max-width: 480px) {
  .lightbox-thumbnails {
    display: none;
  }

  .lightbox-nav {
    padding: 0.75rem;
  }

  .lightbox-prev {
    left: 0.5rem;
  }

  .lightbox-next {
    right: 0.5rem;
  }
}

/* ===== Toast animations (rails-blocks toast component) ===== */
.toast-item {
  position: absolute;
  left: 0;
  right: 0;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: var(--toast-z-index, 0);
}
.toast-item[data-mounted="false"] { opacity: 0; }
.toast-item[data-mounted="false"][data-position^="top"] { transform: translateY(-100%); }
.toast-item[data-mounted="false"][data-position^="bottom"] { transform: translateY(100%); }
.toast-item[data-mounted="true"] { opacity: 1; }
.toast-item[data-removed="true"] { opacity: 0; pointer-events: none; }
.toast-item[data-removed="true"][data-position^="top"] { transform: translateY(-100%); }
.toast-item[data-removed="true"][data-position^="bottom"] { transform: translateY(100%); }
.toast-item[data-expanded="false"][data-visible="true"] {
  transform: translateY(calc(var(--toast-index, 0) * 8px)) scale(calc(1 - var(--toast-index, 0) * 0.05));
}
.toast-item[data-expanded="false"][data-visible="false"] {
  opacity: 0;
  transform: translateY(calc(var(--toast-index, 0) * 8px)) scale(0.9);
}
.toast-item[data-expanded="true"][data-position^="top"] { transform: translateY(var(--toast-offset, 0)); }
.toast-item[data-expanded="true"][data-position^="bottom"] { transform: translateY(calc(var(--toast-offset, 0) * -1)); }
.toast-item[data-expanded="false"] > span { height: var(--front-toast-height, auto); overflow: hidden; }
.toast-item[data-expanded="false"][data-front="true"] > span,
.toast-item[data-expanded="true"] > span { height: auto; overflow: visible; }
.toast-item[data-expanded="false"][data-front="false"] > span > div { opacity: 0; }
.toast-item[data-expanded="false"][data-front="true"] > span > div,
.toast-item[data-expanded="true"] > span > div { opacity: 1; }

/* ===== Rendered rich-text content (Lexxy / .lexxy-content) ===== */
.lexxy-content { color: var(--color-ink-700, #404040); line-height: 1.65; }
.lexxy-content > :first-child { margin-top: 0; }
.lexxy-content > :last-child { margin-bottom: 0; }
.lexxy-content p { margin: 0 0 0.75rem; }
.lexxy-content ul { list-style: disc; padding-left: 1.5rem; margin: 0 0 0.75rem; }
.lexxy-content ol { list-style: decimal; padding-left: 1.5rem; margin: 0 0 0.75rem; }
.lexxy-content li { margin: 0.15rem 0; }
.lexxy-content li::marker { color: var(--color-ink-400, #8B8780); }
.lexxy-content h1 { font-size: 1.5rem; font-weight: 600; margin: 1.25rem 0 0.5rem; color: var(--color-ink-800, #2D2D2D); }
.lexxy-content h2 { font-size: 1.25rem; font-weight: 600; margin: 1.1rem 0 0.5rem; color: var(--color-ink-800, #2D2D2D); }
.lexxy-content h3 { font-size: 1.1rem; font-weight: 600; margin: 1rem 0 0.4rem; color: var(--color-ink-800, #2D2D2D); }
.lexxy-content strong { font-weight: 600; color: var(--color-ink-800, #2D2D2D); }
.lexxy-content a { color: var(--color-violet-600, #7c3aed); text-decoration: underline; }
.lexxy-content blockquote { border-left: 3px solid var(--color-violet-300, #c4b5fd); padding-left: 1rem; margin: 0 0 0.75rem; color: var(--color-ink-500, #6B6B6B); font-style: italic; }
.lexxy-content pre { background: var(--color-ink-900, #1A1A1A); color: #f5f5f5; padding: 0.85rem 1rem; border-radius: 0.75rem; overflow-x: auto; margin: 0 0 0.75rem; font-size: 0.85em; }
.lexxy-content code { background: var(--color-cream-200, #F5F3EF); padding: 0.1rem 0.35rem; border-radius: 0.35rem; font-size: 0.88em; }
.lexxy-content pre code { background: transparent; padding: 0; }
.lexxy-content img { max-width: 100%; height: auto; border-radius: 0.75rem; margin: 0.25rem 0 0.75rem; }
.lexxy-content hr { border: 0; border-top: 1px solid var(--color-ink-100, #F5F5F5); margin: 1.25rem 0; }
.lexxy-content table { width: 100%; border-collapse: collapse; margin: 0 0 0.75rem; font-size: 0.9em; }
.lexxy-content th, .lexxy-content td { border: 1px solid var(--color-ink-200, #D4D0CA); padding: 0.5rem 0.75rem; text-align: left; }
.lexxy-content th { background: var(--color-cream-100, #FAF8F5); font-weight: 600; }
