/* ==========================================================================
   AdCheckLab · Loudness Meter
   The target select uses the shared FORM CONTROLS look; this sheet only
   sets its width. Motion uses the tokens from :root.
   ========================================================================== */


/* Verdict colours come from the shared tokens in style.css (--color-pass-ink
   and friends), which carry their own dark values. */

.loudness-page main.editor-workbench {
  max-width: 1080px;
}

.loudness-page .editor-hero-title {
  font-size: clamp(32px, 5vw, 46px);
  line-height: 1.05;
  letter-spacing: -0.04em;
}

.loudness-page .editor-hero-desc {
  max-width: 700px;
  font-size: 15px;
}

/* ------------------------------------------------------------------ setup */
.lm-setup {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(260px, 1fr);
  gap: 18px;
  align-items: stretch;
  margin-bottom: 18px;
}

.lm-drop {
  margin-bottom: 0;
  min-height: 250px;
  gap: 6px;
}

.lm-drop.dragover {
  border-color: var(--color-ink);
  background: var(--color-surface-alt);
}

.lm-drop:focus-visible {
  outline: 2px solid var(--color-ink);
  outline-offset: 3px;
}

.lm-drop-title {
  margin-top: 8px;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--color-ink);
}

.lm-drop-sub {
  font-size: 13px;
  color: var(--color-mid-gray);
}

.lm-drop-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 14px;
}

.lm-choose {
  padding: 9px 20px;
  font-size: 13px;
}

.lm-privacy {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  font-size: 12px;
  color: var(--color-mid-gray);
}

.lm-privacy .ico {
  width: 14px;
  height: 14px;
}

.lm-target-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 20px;
  background: var(--color-paper);
  border: 1px solid var(--color-hairline);
  border-radius: var(--radius-cards);
}

.lm-target-box label {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--color-mid-gray);
}

.lm-target-box select {
  width: 100%;
}

.lm-target-spec {
  margin: 4px 0 0;
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.5;
  color: var(--color-ink);
}

.lm-target-note {
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
  color: var(--color-mid-gray);
}

.lm-basis {
  align-self: flex-start;
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  padding: 2px 8px;
  border-radius: var(--radius-badges);
  color: var(--color-pass-ink);
  background: var(--color-pass-bg);
}

.lm-basis.is-recommended {
  color: var(--color-info-ink);
  background: var(--color-info-bg);
}

.lm-basis.is-practitioner {
  color: var(--color-warn-ink);
  background: var(--color-warn-bg);
}

.lm-table .lm-basis {
  margin-left: 8px;
  vertical-align: 1px;
}

.lm-source,
.lm-guide a {
  color: var(--color-ink);
  font-weight: 600;
  text-underline-offset: 3px;
}

.lm-source {
  font-size: 13px;
}

.lm-source[hidden] {
  display: none;
}

/* --------------------------------------------------------------- progress */
.lm-progress {
  padding: 18px 20px;
  margin-bottom: 18px;
  background: var(--color-paper);
  border: 1px solid var(--color-hairline);
  border-radius: var(--radius-cards);
}

.lm-progress[hidden],
.lm-error[hidden],
.lm-results[hidden] {
  display: none;
}

.lm-progress-text {
  margin-bottom: 10px;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--color-ink);
}

.lm-progress-track {
  height: 8px;
  overflow: hidden;
  background: var(--color-surface-alt);
  border-radius: 999px;
}

.lm-progress-bar {
  width: 100%;
  height: 100%;
  background: var(--color-ink);
  border-radius: inherit;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--dur-quick) var(--ease-standard);
}

.lm-error {
  padding: 14px 18px;
  margin-bottom: 18px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--color-fail-ink);
  background: var(--color-fail-bg);
  border: 1px solid var(--color-fail-line);
  border-radius: var(--radius-nested);
}

/* ---------------------------------------------------------------- results */
.lm-results {
  display: flex;
  flex-direction: column;
  gap: 16px;
  scroll-margin-top: calc(var(--header-h, 58px) + 16px);
  animation: panelIn var(--dur-base) var(--ease-entrance);
}

.lm-results-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.lm-results-head h2 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 750;
  color: var(--color-ink);
}

.lm-results-head h2:focus {
  outline: none;
}

.lm-file-meta {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--color-mid-gray);
  overflow-wrap: anywhere;
}

.lm-badge,
.lm-chip {
  font-family: var(--mono);
  font-weight: 700;
  border-radius: var(--radius-badges);
  white-space: nowrap;
}

.lm-badge {
  font-size: 12px;
  padding: 6px 12px;
  white-space: normal;
}

.lm-chip {
  display: inline-block;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  padding: 2px 8px;
}

.lm-badge.is-pass,
.lm-chip.is-pass { color: var(--color-pass-ink); background: var(--color-pass-bg); }
.lm-badge.is-warn,
.lm-chip.is-warn { color: var(--color-warn-ink); background: var(--color-warn-bg); }
.lm-badge.is-fail,
.lm-chip.is-fail { color: var(--color-fail-ink); background: var(--color-fail-bg); }

.lm-metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.lm-metric {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px;
  background: var(--color-paper);
  border: 1px solid var(--color-hairline);
  border-radius: var(--radius-nested);
}

.lm-metric-label {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--color-mid-gray);
}

.lm-metric-value {
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--color-ink);
  font-variant-numeric: tabular-nums;
}

.lm-metric-value small {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-mid-gray);
}

.lm-metric-hint {
  font-size: 11.5px;
  color: var(--color-mid-gray);
}

.lm-columns {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
}

.lm-card {
  padding: 18px 20px;
  background: var(--color-paper);
  border: 1px solid var(--color-hairline);
  border-radius: var(--radius-cards);
  min-width: 0;
}

.lm-card h3 {
  margin: 0 0 12px;
  font-size: 15px;
  font-weight: 700;
  color: var(--color-ink);
}

.lm-table-wrap {
  overflow-x: auto;
}

.lm-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.lm-table th,
.lm-table td {
  padding: 9px 10px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--color-hairline);
}

.lm-table thead th {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--color-mid-gray);
  white-space: nowrap;
}

.lm-table tbody th {
  font-weight: 600;
  color: var(--color-ink);
}

.lm-table tbody tr:last-child th,
.lm-table tbody tr:last-child td {
  border-bottom: 0;
}

.lm-table tr.is-selected th,
.lm-table tr.is-selected td {
  background: var(--color-surface-alt);
}

.lm-num {
  font-family: var(--mono);
  white-space: nowrap;
}

.lm-check-note {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  color: var(--color-mid-gray);
}

.lm-gain {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--color-hairline);
}

.lm-gain p {
  margin: 0 0 6px;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--color-ink);
}

.lm-gain-warn {
  color: var(--color-fail-ink) !important;
}

.lm-gain-ok {
  color: var(--color-pass-ink) !important;
}

.lm-curve-wrap {
  width: 100%;
}

.lm-curve-wrap canvas {
  display: block;
  width: 100%;
  height: 220px;
}

.lm-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
  margin: 10px 0 0;
  font-size: 12px;
  color: var(--color-mid-gray);
}

.lm-key {
  display: inline-block;
  width: 16px;
  height: 3px;
  margin-right: -6px;
  border-radius: 2px;
}

.lm-key-curve { background: var(--color-ink); }
.lm-key-target { background: var(--color-pass); }
.lm-key-limit { background: var(--color-ember); }

.lm-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.lm-actions .btn-primary {
  min-height: 42px;
  padding: 0 20px;
  font-size: 13px;
}

.lm-actions .btn-primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.lm-actions .ico {
  width: 15px;
  height: 15px;
}

.lm-wav-note {
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
  color: var(--color-mid-gray);
}

/* --------------------------------------------- loudness fixed inside the video (Pro) */
.lm-fix[hidden],
.lm-fix-result[hidden] {
  display: none;
}

.lm-fix {
  display: grid;
  gap: 14px;
}

.lm-fix h3 {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.lm-pro-badge {
  display: inline-flex;
  padding: 2px 8px;
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-on-ink);
  background: var(--color-ink);
  border-radius: 999px;
}

.lm-fix-lead,
.lm-fix-plan,
.lm-fix-steps {
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
  color: var(--color-ink-soft);
}

.lm-fix-plan {
  margin-top: 8px;
  color: var(--color-ink);
}

.lm-fix-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

/* The buttons set their own display, so hidden needs saying here. */
.lm-fix-actions > [hidden] {
  display: none;
}

.lm-fix-actions .btn-primary {
  min-height: 42px;
  padding: 0 20px;
  font-size: 13px;
}

.lm-fix-actions .btn-primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.lm-fix-actions .ico {
  width: 15px;
  height: 15px;
}

.lm-fix-progress {
  margin: 0;
  padding: 14px 16px;
  background: var(--color-surface-alt);
  border-radius: var(--radius-nested);
}

.lm-fix-note {
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
  color: var(--color-mid-gray);
}

.lm-fix-note:empty {
  display: none;
}

.lm-fix-result {
  display: grid;
  gap: 12px;
  padding-top: 14px;
  border-top: 1px solid var(--color-hairline);
}

.lm-fix-result h4 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--color-ink);
}

.lm-fix-verdict {
  margin: 0;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.5;
  border: 1px solid var(--color-hairline);
  border-radius: var(--radius-nested);
}

.lm-fix-verdict.is-pass { color: var(--color-pass-ink); background: var(--color-pass-bg); border-color: var(--color-pass-line); }
.lm-fix-verdict.is-warn { color: var(--color-warn-ink); background: var(--color-warn-bg); border-color: var(--color-warn-line); }
.lm-fix-verdict.is-fail { color: var(--color-fail-ink); background: var(--color-fail-bg); border-color: var(--color-fail-line); }

/* ------------------------------------------------------------------ guide */
.lm-guide {
  padding: 64px 20px 72px;
  background: var(--color-paper);
  border-top: 1px solid var(--color-hairline);
}

.lm-guide-inner {
  max-width: 800px;
  margin: 0 auto;
}

.lm-guide .section-label {
  color: var(--color-ember-text);
}

.lm-guide h2 {
  margin: 32px 0 10px;
  font-size: clamp(20px, 2.6vw, 26px);
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--color-ink);
}

.lm-guide h2:first-of-type {
  margin-top: 8px;
}

.lm-guide p,
.lm-guide li {
  font-size: 14.5px;
  line-height: 1.7;
  color: var(--color-ink-soft);
}

.lm-guide ul {
  padding-left: 20px;
  margin: 10px 0 0;
}

.lm-guide li + li {
  margin-top: 6px;
}

.lm-guide .lm-table-wrap {
  margin: 14px 0;
  border: 1px solid var(--color-hairline);
  border-radius: var(--radius-nested);
}

.lm-targets {
  min-width: 620px;
}

.lm-faq {
  margin-top: 40px;
}

.lm-faq .faq-accordion {
  margin-top: 14px;
}

/* ------------------------------------------------------------- responsive */
@media (max-width: 900px) {
  .lm-setup,
  .lm-columns {
    grid-template-columns: 1fr;
  }

  .lm-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .lm-drop {
    min-height: 220px;
    padding: 28px 16px;
  }

  .lm-target-box,
  .lm-card {
    padding: 16px;
  }

  .lm-metric-value {
    font-size: 1.25rem;
  }

  .lm-table {
    font-size: 12.5px;
  }

  .lm-table th,
  .lm-table td {
    padding: 8px 6px;
  }

  .lm-table thead th {
    font-size: 10px;
    letter-spacing: 0.3px;
    white-space: normal;
  }

  .lm-results .lm-num {
    white-space: normal;
  }

  /* The target list repeats the integrated level from the guide table, so
     a phone keeps the verdict column in view instead. */
  .lm-all th:nth-child(2),
  .lm-all td:nth-child(2) {
    display: none;
  }

  .lm-actions .btn-primary,
  .lm-actions .bulk-btn,
  .lm-fix-actions .btn-primary,
  .lm-fix-actions .bulk-btn {
    flex: 1 1 100%;
  }

  .lm-guide {
    padding: 48px 16px 56px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .lm-results {
    animation: none;
  }

  .lm-progress-bar {
    transition: none;
  }
}
