/* ──────────────────────────────────────────────────────────────────────────
   video-downloader.css — the page-local styles for /download and its four
   localized copies (/vi, /id, /ru, /zh-tw /download).

   EXTRACTED VERBATIM 2026-09-05 from the <style> block that used to be inline
   in public/download.html. It was byte-identical in public/zh-tw/download.html
   and a truncated PREFIX of it in vi/id/ru — which is exactly how those three
   ended up with no photo grid: the CSS for it was never copied across, so the
   markup could not be either. One file now, five consumers, nothing to drift.

   Scope: .hero / .card / bare label / input[type=url] / .note are page-level
   overrides that already applied on all five pages; everything prefixed dl- is
   this tool's own component set (result grid, media card, badges, spinner).
   .dl-langnav lives in styles.css and is deliberately NOT here.
   ────────────────────────────────────────────────────────────────────────── */

/* h1 and .lead use shared styles */

/* Page-specific: hero overrides */
.hero {
  border-radius: 20px;
  padding: 32px 24px;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(10px);
  margin-bottom: 24px;
}

/* Page-specific: card styles */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 28px 24px;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}

.card h2 {
  margin: 0 0 16px;
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
}

.card p {
  margin: 0 0 12px;
  color: var(--text-secondary);
}

.card p:last-child {
  margin-bottom: 0;
}

/* Page-specific: standalone form elements (not in .input-group) */
label {
  font-weight: 500;
  color: var(--text-secondary);
}

input[type="url"] {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 16px;
  font-family: inherit;
}

input[type="url"]:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgb(99 102 241 / 0.1);
}

.note {
  margin-top: 12px;
  font-size: 14px;
  color: var(--text-muted);
}

@media (max-width: 840px) {
  .hero, .card { padding: 24px 20px; }
}

/* ============================================
   Page-local components (dl- prefix, NOT shared)
   ============================================ */

/* Freshness line near the H1 */
.dl-freshness {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin: 0 0 8px;
}
.dl-freshness::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--success);
}

/* Above-the-fold benefit strip */
.dl-benefit-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0 4px;
  padding: 0;
  list-style: none;
}
.dl-benefit-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}
.dl-benefit-chip svg {
  flex: none;
  width: 14px;
  height: 14px;
  color: var(--success);
}

/* Honest quality clarity line under the form */
.dl-quality-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 14px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-muted);
}

/* Under-the-button note that BOTH /share/ and /post/ links are accepted.
   The placeholder can only show one example; this carries the other. */
.dl-link-hint {
  margin: 10px 0 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-muted);
}
.dl-link-hint strong { font-weight: 600; color: var(--text-secondary); word-break: break-word; }
.dl-quality-note svg {
  flex: none;
  width: 15px;
  height: 15px;
  margin-top: 1px;
  color: var(--text-secondary);
}

/* Honest status: indeterminate spinner (no fake step progress) */
.dl-loading {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
}
.dl-spinner {
  flex: none;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  border: 2.5px solid var(--border);
  border-top-color: var(--text);
  animation: dl-spin 0.7s linear infinite;
}
.dl-loading-text {
  font-weight: 600;
  color: var(--text);
  font-size: 15px;
}
.dl-loading-sub {
  margin-top: 2px;
  font-size: 13px;
  color: var(--text-secondary);
}
@keyframes dl-spin {
  to { transform: rotate(360deg); }
}
@media (prefers-reduced-motion: reduce) {
  .dl-spinner { animation-duration: 1.6s; }
}

/* Primary download button — monochrome brand primary (AA: #fff on #000). */
.dl-download-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  background: var(--primary);
  color: var(--bg);
  border: 0;
  padding: 11px 22px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: var(--transition);
}
.dl-download-btn:hover:not(:disabled) {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}
.dl-download-btn:disabled { opacity: 0.6; cursor: default; }

/* Demoted secondary actions */
.dl-secondary-btn {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  background: none;
  color: var(--text-secondary);
  border: 0;
  padding: 8px 6px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  text-decoration: underline;
}
.dl-secondary-btn:hover { color: var(--text); }

@media (prefers-reduced-motion: reduce) {
  .dl-download-btn:hover:not(:disabled) { transform: none; }
}

@media (max-width: 480px) {
  .dl-benefit-chip { font-size: 12px; padding: 6px 12px; }
}

/* ---- Combined media result: section heads, grid, cards ---- */
.dl-media-group { margin-top: 28px; }

.dl-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.dl-result-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
}
.dl-result-title svg {
  flex: none;
  width: 18px;
  height: 18px;
  color: var(--text-secondary);
}
.dl-group-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
}
.dl-group-count:empty { display: none; }

/* "Download all" — secondary outline button, clearly below the per-item CTA */
.dl-downloadall-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition);
}
.dl-downloadall-btn:hover:not(:disabled) { border-color: var(--text-muted); }
.dl-downloadall-btn:disabled { opacity: 0.6; cursor: default; }

.dl-media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

/* A single media card */
.dl-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
}

/* Thumbnail area — fixed aspect-ratio reserves space → no CLS */
.dl-thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 5;
  background: var(--surface-2);
  overflow: hidden;
}
.dl-thumb img,
.dl-thumb video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border: 0;
}
/* Index pill for carousels */
.dl-index-pill {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 9px;
  border-radius: 999px;
  background: rgb(0 0 0 / 0.62);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.01em;
  backdrop-filter: blur(2px);
}

.dl-card-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
}

/* Format + resolution badge sits above the button */
.dl-format-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 22px;
}
.dl-format-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 3px 10px;
  border-radius: 999px;
  white-space: nowrap;
}
.dl-format-badge.is-hd::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--success);
}

/* Per-card primary download = full-width, the focal action */
.dl-card .dl-download-btn {
  width: 100%;
  padding: 11px 16px;
}

/* Secondary links row, demoted under the primary button */
.dl-secondary-row {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}
.dl-secondary-row .dl-secondary-btn { min-height: 36px; padding: 6px 8px; }

/* ---- Finish line: #status as a real "Done" banner ----
   Set by video-downloader.js showDone(). The wait ad sits between the form and
   here, so the JS scrolls this into view on every outcome; scroll-margin keeps
   it clear of the 60px sticky .site-nav. Deliberately NOT styled like the ad
   (no blue left accent, no pill CTA) so the two can never be confused. Text is
   var(--text) on a light tint — the brand --success green is 2.3:1 as text, so
   green carries only the icon disc, never the words. */
#status { scroll-margin-top: 76px; }
#status:focus { outline: none; }
.dl-result-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.4;
  color: var(--text);
}
.dl-result-banner.is-success {
  background: rgba(34, 197, 94, 0.10);
  border: 1px solid rgba(34, 197, 94, 0.45);
}
.dl-result-banner-icon {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: #15803d;
  color: #fff;
}
.dl-result-banner-icon svg { width: 16px; height: 16px; }
.dl-result-banner-title { display: block; font-size: 16px; font-weight: 700; }
.dl-result-banner-hint { display: block; margin-top: 1px; }
@media (prefers-color-scheme: dark) {
  .dl-result-banner.is-success { background: rgba(52, 211, 153, 0.12); border-color: rgba(52, 211, 153, 0.40); }
  .dl-result-banner-icon { background: var(--success); color: #0a0a0a; }
}

/* Empty / no-media note */
.dl-empty {
  grid-column: 1 / -1;
  padding: 18px 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 14px;
  color: var(--text-secondary);
  text-align: center;
}

@media (max-width: 480px) {
  .dl-media-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
  .dl-card-body { padding: 12px; }
}

/* Visible keyboard focus for all page-local interactive controls (WCAG AA) */
.dl-download-btn:focus-visible,
.dl-secondary-btn:focus-visible,
.dl-downloadall-btn:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 2px;
}
.dl-thumb video:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: -2px;
}
