/* Thumbnail Downloader: layout only, primitives come from components/ui.css */
.th-body {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.th-url-bar { margin-top: 2.5rem; }

.th-chips {
  max-width: 1040px;
  margin-top: 1rem;
  gap: 0.5rem;
}

.th-error {
  max-width: 820px;
  margin-top: 1.5rem;
}

/* ---------- Result ---------- */
.th-result-wrap {
  --ui-card-glow-inset: 40px 60px -30px;
  --ui-card-glow-inset-mobile: 30px 10px -20px;
  --ui-card-glow-opacity: 0;
  width: 100%;
  max-width: 1040px;
  margin-top: 3.5rem;
  text-align: left;
}

.th-result-wrap::before { transition: opacity 0.4s var(--ui-ease); }
.th-result-wrap.has-result { --ui-card-glow-opacity: 0.6; }

.th-result {
  --ui-card-pad: 1.5rem;
  display: grid;
  grid-template-columns: minmax(0, 620fr) minmax(0, 340fr);
  gap: 2rem;
  align-items: center;
  animation: th-rise 0.45s var(--ui-ease) both;
}

@keyframes th-rise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}

.th-preview {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: 18px;
  overflow: hidden;
  background: var(--ui-surface-solid);
}

.th-preview img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Portrait and square thumbnails are shown whole instead of cropped */
.th-preview.is-contain img { object-fit: contain; }

.th-preview-shade {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 40%;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.5));
  pointer-events: none;
}

/* Sits on the image, so it keeps its own colours in both themes */
.th-res {
  position: absolute;
  right: 14px;
  bottom: 14px;
  padding: 5px 10px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.6);
  color: rgb(244, 244, 245);
  font-size: 0.8125rem;
  font-weight: 700;
  line-height: 1.25;
}

.th-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
}

.th-platform { display: flex; }

.th-title {
  margin: 1rem 0 0;
  font-family: var(--ui-display);
  font-size: 1.5rem;
  line-height: 1.25;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
  line-clamp: 4;
  overflow: hidden;
}

.th-channel {
  margin: 0.5rem 0 0;
  font-size: 0.9375rem;
  color: var(--text-secondary);
  overflow-wrap: anywhere;
}

.th-channel:empty { display: none; }

.th-actions {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  width: 100%;
  margin-top: 1.5rem;
}

.th-try {
  align-self: center;
  margin-top: -2px;
}

@media (min-width: 769px) {
  .th-empty { --ui-empty-h: 398px; }
}

.th-empty p { margin: 0; }

/* ---------- Steps ---------- */
.th-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  text-align: left;
}

@media (min-width: 769px) {
  .th-steps-row {
    display: flex;
    gap: 1rem;
    width: 100%;
    max-width: 1040px;
    margin-top: 3rem;
  }

  .th-steps-row > li {
    flex: 1;
    min-width: 0;
  }
}

@media (max-width: 900px) {
  .th-result { grid-template-columns: minmax(0, 1fr); gap: 1.25rem; }
}

@media (max-width: 768px) {
  .th-url-bar { margin-top: 1.75rem; }
  .th-chips { margin-top: 1.25rem; }
  .th-error { margin-top: 1.25rem; }
  .th-result-wrap { margin-top: 2rem; }

  .th-result {
    --ui-card-pad: 0.875rem;
    gap: 1rem;
  }

  .th-preview { border-radius: 14px; }

  .th-res {
    right: 10px;
    bottom: 10px;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
  }

  .th-platform,
  .th-title,
  .th-channel { margin-left: 4px; margin-right: 4px; }

  .th-title {
    margin-top: 0.75rem;
    font-size: 1.25rem;
    line-height: 1.3;
  }

  .th-channel { margin-top: 0.375rem; font-size: 0.875rem; }
  .th-actions { margin-top: 1rem; }
  .th-try { align-self: stretch; margin-top: 0; }

  .th-steps-mobile {
    width: 100%;
    margin-top: 2.5rem;
    text-align: left;
  }

  .th-steps-col {
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
    margin-top: 0.75rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .th-result { animation: none; }
  .th-result-wrap::before { transition: none; }
}
