/* ========== Animations & Scroll Reveals ========== */

/* Respect reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ===== Title Acronym Animation ===== */
.title-word {
  display: inline;
  transition: color 0.5s ease, text-shadow 0.4s ease;
}

.title-acronym {
  display: inline;
  transition: color 0.5s ease, text-shadow 0.4s ease;
}

.title-word.highlight {
  color: #2563eb;
  animation: popGlow 0.6s ease forwards;
}

.title-word.highlight .title-acronym {
  color: #2563eb;
  font-weight: 900;
}

/* For S, I, D — only the first letter highlights */
.title-acronym.highlight {
  color: #2563eb;
  font-weight: 900;
  animation: popGlow 0.5s ease forwards;
}

@keyframes popGlow {
  0% { text-shadow: none; }
  40% { text-shadow: 0 0 12px rgba(37, 99, 235, 0.6), 0 0 24px rgba(37, 99, 235, 0.3); }
  100% { text-shadow: none; }
}

.acronym-reveal {
  margin-top: 0.5rem;
  opacity: 0;
  transform: translateX(-20px);
  transition: opacity 0.6s ease 0.3s, transform 0.6s ease 0.3s;
}

.acronym-reveal.visible {
  opacity: 1;
  transform: translateX(0);
}

.acronym-text {
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
  font-family: 'SF Mono', 'Fira Code', monospace;
}

.acronym-char {
  color: #2563eb;
  font-weight: 800;
}

/* Scroll reveal - fade up */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Teaser comparison layout */
.teaser-comparison {
  display: flex;
  align-items: flex-start;
  gap: 1.5rem;
  margin: 2rem 0;
}

.teaser-vs {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-light);
  min-width: 50px;
}

/* Teaser cards */
.teaser-card {
  flex: 1;
  border-radius: var(--radius-lg);
  padding: 2rem;
  border: 2px solid var(--border-color);
  background: var(--bg-primary);
  display: flex;
  flex-direction: column;
}

.teaser-card--trained {
  border-color: #fca5a5;
  background: #fefefe;
  flex: 0.7;
}

.teaser-card--ours {
  border-color: #86efac;
  background: #f0fdf4;
  flex: 1.3;
}

.teaser-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.teaser-card__label {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-primary);
}

.teaser-card__badge {
  background: #dcfce7;
  color: #166534;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.3rem 0.7rem;
  border-radius: 20px;
}

.teaser-card__content {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.teaser-card__content.ours-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto auto;
  gap: 0.75rem 1rem;
  align-items: stretch;
}

.teaser-card--trained .teaser-card__content {
  min-height: 320px;
}

.teaser-card__footer {
  display: flex;
  gap: 1rem;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
}

.teaser-card__footer .stat {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 600;
}

.teaser-card__footer .stat--highlight {
  color: #166534;
}

/* SinDDM input selector */
.sinddm-inputs {
  margin-bottom: 1.25rem;
}

.sinddm-inputs__label {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.4rem;
}

.sinddm-inputs__grid {
  display: flex;
  gap: 0.5rem;
}

.sinddm-input-thumb {
  width: 50px;
  height: 50px;
  border-radius: 6px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color 0.2s, transform 0.2s;
  overflow: hidden;
}

.sinddm-input-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.sinddm-input-thumb:hover {
  transform: scale(1.05);
  border-color: #fca5a5;
}

.sinddm-input-thumb.active {
  border-color: #dc2626;
  box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.2);
}

/* Training progress bar animation */
.training-progress {
  margin-bottom: 1.5rem;
}

.training-progress__bar {
  height: 20px;
  background: #fee2e2;
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.training-progress__fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #f87171, #dc2626);
  border-radius: 10px;
  transition: width 1s linear;
}

.training-progress__pct {
  font-size: 0.75rem;
  font-weight: 700;
  color: #dc2626;
  margin-top: 0.25rem;
  display: block;
}

.training-progress__time {
  font-size: 0.85rem;
  color: #dc2626;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.time-counter {
  font-family: 'SF Mono', 'Fira Code', monospace;
}

.time-remaining {
  font-size: 0.75rem;
  color: #b91c1c;
  opacity: 0.8;
}

/* Skip training button */
.skip-training-btn {
  display: none !important;
  margin-top: 1rem;
  padding: 0.5rem 1.2rem;
  background: #fef2f2;
  border: 2px solid #fca5a5;
  border-radius: 20px;
  color: #dc2626;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  transition: opacity 0.3s ease, transform 0.3s ease;
  align-self: center;
}

.skip-training-btn.visible {
  display: inline-block !important;
  animation: fadeInUp 0.5s ease forwards;
}

.skip-training-btn:hover {
  background: #fee2e2;
  border-color: #f87171;
  transform: scale(1.05);
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* SinDDM results after training */
.sinddm-results__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.sinddm-result-item {
  width: 100%;
  max-width: 120px;
  border-radius: var(--radius);
  animation: fadeInResult 0.6s ease forwards;
  display: block;
  object-fit: cover;
}

.sinddm-done-text {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-style: italic;
}

/* Placeholder grid for teaser results */
.placeholder-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.placeholder-grid--locked .placeholder-item {
  position: relative;
  overflow: hidden;
}

.placeholder-grid--locked .placeholder-item::after {
  content: '🔒';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  background: rgba(226, 232, 240, 0.8);
}

.placeholder-item {
  aspect-ratio: 1;
  border-radius: var(--radius);
  background: #e2e8f0;
}

@keyframes fadeInResult {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}

.waiting-text {
  font-size: 0.85rem;
  color: var(--text-light);
  font-style: italic;
}

.ready-text {
  font-size: 0.85rem;
  color: #166534;
  font-weight: 600;
}

/* Resolution badges */
.res-badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 10px;
  vertical-align: middle;
  margin-left: 0.4rem;
}

.res-badge--low {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fca5a5;
}

.res-badge--high {
  background: #f0fdf4;
  color: #166534;
  border: 1px solid #86efac;
}

/* ===== Ours card: input selector + slideshow ===== */
.ours-inputs {
  margin-bottom: 0;
}

.ours-inputs__label {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.4rem;
}

.ours-inputs__grid {
  display: flex;
  gap: 0.5rem;
}

.ours-input-preview {
  max-width: 100%;
  max-height: 100%;
  border-radius: var(--radius);
  display: block;
  object-fit: contain;
  border: 2px solid #166534;
  box-shadow: 0 0 0 2px rgba(22, 101, 52, 0.15);
}

.ours-input-thumb {
  width: 50px;
  height: 50px;
  flex-shrink: 0;
  border-radius: 6px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color 0.2s, transform 0.2s;
  overflow: hidden;
}

.ours-input-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.ours-input-thumb:hover {
  transform: scale(1.05);
  border-color: #86efac;
}

.ours-input-thumb.active {
  border-color: #166534;
  box-shadow: 0 0 0 2px rgba(22, 101, 52, 0.2);
}

.ours-slideshow__label,
.ours-megapixel__label {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.4rem;
}

.ours-slideshow__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
}

.ours-slide-item {
  width: 100%;
  height: 50px;
  border-radius: var(--radius);
  transition: opacity 0.15s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  display: block;
  object-fit: cover;
  border: 2px solid transparent;
}

.ours-slide-item.ours-slide-hidden {
  opacity: 0;
}

.ours-slide-item.ours-slide-current {
  border-color: #166534;
  box-shadow: 0 0 0 2px rgba(22, 101, 52, 0.25);
  border-radius: var(--radius);
}

/* Megapixel upgrade */
.ours-megapixel {
  margin-top: 0;
}

.ours-megapixel__img {
  max-width: 100%;
  max-height: 100%;
  border-radius: var(--radius);
  display: block;
  object-fit: contain;
}

.megapixel-enter {
  animation: scaleIn 0.5s ease forwards;
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}

/* Hidden utility */
.hidden {
  display: none !important;
}
