/*
 * SJS Audio site theme overrides for ReKit.
 * Loads after style.css. Keep style.css as a verbatim copy of the upstream
 * ReKit/v3/web/ source — re-theme everything here.
 */

:root {
  --bg: #1a1a1a;
  --surface: transparent;
  --surface-hover: rgba(240, 240, 240, 0.06);
  --border: rgba(240, 240, 240, 0.22);
  --text: #f0f0f0;
  --text-secondary: rgba(240, 240, 240, 0.55);
  --accent: #f0f0f0;
  --accent-hover: #ffffff;
  --danger: #d98a8a;
  --danger-hover: #e8a4a4;
  --success: #9dcaa6;
  --warning: #d9c08a;
  --radius: 0;
}

/* Back link to home (not in upstream HTML) */
.site-back {
  position: fixed;
  top: 1.25rem;
  left: 1.5rem;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--text-secondary);
  transition: color 0.15s;
}
.site-back:hover {
  color: var(--accent);
}

/* Home-page label rhythm: 0.08em on every uppercase small caption */
.picker-group label,
.preset-row label,
.preset-status-label,
.help-section h3 {
  letter-spacing: 0.08em;
}

/* Header: icon left, ReKit + subtitle stacked right. */
.rekit-header {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 24px;
  margin-bottom: 32px;
}

.rekit-icon {
  width: 170px;
  height: 170px;
  display: block;
  flex-shrink: 0;
}

.rekit-titles {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Override upstream centering — title now lives in the flex column. */
.rekit-titles h1,
.rekit-titles .subtitle {
  text-align: left;
  margin: 0;
  font-family: "IBM Plex Mono", Menlo, Consolas, "Liberation Mono", monospace;
  text-transform: uppercase;
}

.rekit-titles h1 {
  font-size: 3rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  line-height: 1;
}

/* Selectively shrink characters that were lowercase in the source ("ReKit"),
   so the all-caps title still echoes the original camelcase rhythm. */
.rekit-titles h1 .lc {
  font-size: 0.78em;
}

.rekit-titles .subtitle {
  font-size: 0.95rem;
  font-weight: 400;
  letter-spacing: 0.12em;
  color: var(--text-secondary);
}

.rekit-about-link {
  align-self: flex-start;
  margin-top: 4px;
  font-family: "IBM Plex Mono", Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  text-decoration: none;
  text-transform: uppercase;
  opacity: 0.7;
  transition: opacity 0.15s ease, color 0.15s ease;
}

.rekit-about-link:hover {
  opacity: 1;
  color: var(--accent);
}

html {
  scroll-behavior: smooth;
}

/* Force an explicit dark surface on selects + options. With --surface as
   transparent, Windows/Chromium fall through to system colors in the popup,
   producing white text on white background. */
.picker-group select,
.preset-row select,
.routed-row .route-select {
  background-color: var(--bg);
}
.picker-group option,
.preset-row option,
.routed-row .route-select option {
  background-color: var(--bg);
  color: var(--text);
}

@media (max-width: 540px) {
  .rekit-header {
    flex-direction: column;
    align-items: center;
    gap: 14px;
  }
  .rekit-titles h1,
  .rekit-titles .subtitle,
  .rekit-titles .rekit-about-link {
    text-align: center;
  }
  .rekit-titles .rekit-about-link {
    align-self: center;
  }
  .rekit-titles h1 {
    font-size: 2.4rem;
  }
}

/* Primary buttons echo the home page's .tool-link: bordered transparent,
   uppercase + letter-spaced, invert on hover. */
.convert-btn {
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.convert-btn:hover:not(:disabled) {
  background: var(--accent);
  color: var(--bg);
}

.download-btn {
  font-size: 0.9rem;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.download-btn:hover {
  background: var(--accent);
  color: var(--bg);
}

/* Clear All: neutral border, not red — danger styling reserved for the
   actual error states / unmapped badges. */
.clear-btn {
  border: 1px solid var(--border);
  color: var(--text-secondary);
}
.clear-btn:hover:not(:disabled) {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}

/* Drop-zone drag-active: drop the blue glow, just brighten the border. */
.drop-zone.drag-active {
  background: rgba(240, 240, 240, 0.04);
  box-shadow: none;
}

/* Empty-state hover: neutral wash, not blue. */
.empty-state:hover,
.empty-state:focus-visible {
  background: rgba(240, 240, 240, 0.04);
}

/* Unknown-note badge / sub-section — warm muted tone instead of orange. */
.unknown-badge {
  color: var(--warning);
  background: rgba(217, 192, 138, 0.12);
}
.sub-section-unknown summary {
  color: var(--warning);
}

/* Error message: tone matches the new --danger. */
.message.error {
  background: rgba(217, 138, 138, 0.08);
  border-color: rgba(217, 138, 138, 0.3);
}

/* Routing-body inset: subtle white wash instead of black. */
.routing-body {
  background: rgba(255, 255, 255, 0.02);
}

/* Square corners everywhere except the pill badges (which earn their roundness). */
.routed-row .route-select,
.routing-reset-btn,
.file-row .remove-btn {
  border-radius: 0;
}

/* Mapping action buttons (Save / Load / Clear / Re-apply): match the
   site's secondary-action rhythm — uppercase, letter-spaced, transparent. */
.mapping-btn {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.75rem;
  font-weight: 400;
}
.mapping-btn-small {
  font-size: 0.7rem;
}

/* Preset status line: monospace filename, tonal continuity with subtitle. */
.preset-filename {
  font-family: "IBM Plex Mono", Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 0.78rem;
}

/* ============================================================
 * Library Request modal
 * Triggered from a small prompt under the destination picker.
 * Uses the native <dialog> element for backdrop + ESC-to-close.
 * ============================================================ */

.lib-request-prompt {
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin: -8px 0 24px;
}

.rekit-footer-link {
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin: 28px 0 12px;
  opacity: 0.7;
}
.rekit-footer-link:hover {
  opacity: 1;
}

.lib-request-link {
  background: none;
  border: none;
  padding: 0;
  margin-left: 6px;
  font: inherit;
  color: var(--accent);
  letter-spacing: 0.04em;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.lib-request-link:hover {
  color: var(--accent-hover);
}

/* Inline-in-paragraph variant (About ReKit blurb): no left margin so the
   button reads as flowing prose with proper punctuation spacing. */
.help-section p .lib-request-link {
  margin: 0;
}

/* Modal container — explicitly centered, height-bounded */
.lib-request-modal {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0;
  max-width: 540px;
  width: calc(100% - 32px);
  max-height: calc(100vh - 64px);
  font-family: inherit;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  margin: 0;
}
.lib-request-modal::backdrop {
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(2px);
}
.lib-request-modal[open] {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Form layout: header + scroll body + sticky footer */
.lib-request-form {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
}
.lib-request-body {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 20px 28px 18px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.lib-request-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 22px 28px 14px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.lib-request-header h2 {
  margin: 0;
  font-family: "IBM Plex Mono", Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.lib-request-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.6rem;
  line-height: 1;
  padding: 0 4px;
  cursor: pointer;
}
.lib-request-close:hover {
  color: var(--accent);
}

.lib-request-intro {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--text-secondary);
}

/* Honeypot — visually hidden but available to bots */
.lib-request-honeypot {
  position: absolute !important;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
}

/* Field group */
.lib-request-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.lib-request-field label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
}
.lib-request-field input[type="text"],
.lib-request-field input[type="email"],
.lib-request-field textarea {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 0;
  color: var(--text);
  padding: 9px 10px;
  font: inherit;
  font-size: 0.92rem;
  transition: border-color 0.15s;
}
.lib-request-field input:focus,
.lib-request-field textarea:focus {
  outline: none;
  border-color: var(--accent);
}
.lib-request-field textarea {
  resize: vertical;
  min-height: 70px;
}

.lib-request-help {
  margin: 0;
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.5;
}
.lib-request-help-inline {
  margin: 0 0 2px;
}
.lib-request-help-title {
  margin: 0 0 6px;
}
.lib-request-help ul {
  list-style: disc;
  margin: 0 0 8px;
  padding-left: 18px;
}
.lib-request-help li {
  margin-bottom: 4px;
}
.lib-request-help li strong {
  color: var(--text);
  font-weight: 600;
}
.lib-request-help-limit {
  margin: 0 0 4px;
  font-size: 0.74rem;
  opacity: 0.8;
}

/* Drop zone */
.lib-request-dropzone {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed var(--border);
  padding: 22px 16px;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.lib-request-dropzone:hover,
.lib-request-dropzone.drag-active {
  border-color: var(--accent);
  background: rgba(240, 240, 240, 0.04);
  color: var(--accent);
}

/* File chips */
.lib-request-file-list {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.lib-request-file-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  font-size: 0.82rem;
}
.lib-request-file-name {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: "IBM Plex Mono", Menlo, Consolas, "Liberation Mono", monospace;
}
.lib-request-file-size {
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
}
.lib-request-file-remove {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.2rem;
  line-height: 1;
  padding: 0 4px;
  cursor: pointer;
}
.lib-request-file-remove:hover {
  color: var(--danger);
}

/* Status line (success / error / warn / sending) */
.lib-request-status {
  font-size: 0.85rem;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-left-width: 3px;
}
.lib-request-status.hidden {
  display: none;
}
.lib-request-status.success {
  color: var(--success);
  border-left-color: var(--success);
}
.lib-request-status.error {
  color: var(--danger);
  border-left-color: var(--danger);
}
.lib-request-status.warn {
  color: var(--warning);
  border-left-color: var(--warning);
}

/* Footer — pinned to the bottom of the modal, never scrolled past */
.lib-request-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 28px 18px;
  background: var(--bg);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.lib-request-footer .convert-btn,
.lib-request-footer .mapping-btn {
  padding: 8px 18px;
}

@media (max-width: 540px) {
  .lib-request-modal {
    max-height: calc(100vh - 32px);
    width: calc(100% - 16px);
  }
  .lib-request-header {
    padding: 16px 18px 12px;
  }
  .lib-request-body {
    padding: 14px 18px 12px;
    gap: 14px;
  }
  .lib-request-footer {
    padding: 12px 18px 14px;
  }
}
