/* Styles for the /tools/ micro-tools. Loaded ALONGSIDE the site-wide
   style.css, which provides the shell (.app-shell, .hero, .panel, .faq-*,
   .site-footer, .hero-cta, .hero-link). This file only adds the widget
   chrome that the tools need, using the same design tokens. Kept separate
   from style.css so the tools scaffold stays self-contained. */

/* Inline links inside tool copy use the brand red, never browser blue. */
.tool-card a,
.tool-intro a {
  color: var(--record-red);
  text-decoration: none;
  font-weight: 600;
}
.tool-card a:hover,
.tool-intro a:hover {
  color: var(--record-red-strong);
  text-decoration: underline;
}

/* Two tool cards side by side on wide screens, stacked on narrow. */
.tool-grid {
  display: grid;
  /* min(100%, 320px) keeps two columns on wide screens but never forces a
     track wider than the viewport, so nothing overflows on a narrow phone. */
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
  gap: 20px;
  margin-top: 8px;
}

.tool-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 22px 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.tool-card h2,
.tool-card h3 {
  margin: 0;
  font-size: 1.18rem;
}

.tool-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

/* Live camera preview. No solid background until a feed is attached, so the
   placeholder text shows through; 16:9 keeps the layout stable. */
.tool-video-wrap {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: 14px;
  overflow: hidden;
  background: #0b1622;
  display: flex;
  align-items: center;
  justify-content: center;
}
.tool-video-wrap video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.tool-video-wrap video.is-mirrored {
  transform: scaleX(-1);
}
.tool-video-placeholder {
  position: absolute;
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.95rem;
  text-align: center;
  padding: 0 18px;
  pointer-events: none;
}

/* Microphone level meter. */
.meter {
  height: 18px;
  border-radius: 999px;
  background: rgba(16, 32, 51, 0.08);
  overflow: hidden;
  border: 1px solid var(--line);
}
.meter-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--success-green) 0%, #d8d531 68%, var(--record-red) 100%);
  transition: width 70ms linear;
}
.meter-caption {
  font-size: 0.85rem;
  color: var(--muted);
}

/* Device pickers + toggles. */
.tool-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}
.tool-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1 1 auto;
  min-width: 0;
}
.tool-field label,
.tool-toggle {
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 600;
}
.device-select {
  width: 100%;
  padding: 9px 11px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font: inherit;
}
.device-select:disabled {
  opacity: 0.6;
}
.tool-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}
.tool-toggle input {
  width: 16px;
  height: 16px;
  accent-color: var(--record-red);
}

.tool-info {
  font-size: 0.85rem;
  color: var(--muted);
  min-height: 1.1em;
}

/* Action buttons. Reuses .hero-cta for the primary; .tool-btn is the ghost
   secondary used for Stop. */
.tool-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.tool-btn {
  appearance: none;
  border: 1.5px solid var(--line);
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  padding: 11px 18px;
  border-radius: 12px;
  cursor: pointer;
}
.tool-btn:hover {
  border-color: var(--record-red);
  color: var(--record-red);
}
.tool-btn[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
}

/* Status line under each card. */
.tool-status {
  font-size: 0.9rem;
  border-radius: 10px;
  padding: 9px 12px;
  line-height: 1.4;
}
.tool-status--info { background: rgba(0, 159, 216, 0.1); color: var(--accent-text); }
.tool-status--ok { background: rgba(22, 199, 132, 0.12); color: var(--success-green-strong); }
.tool-status--error { background: rgba(233, 74, 64, 0.1); color: var(--record-red-strong); }

/* Privacy badge shown on every tool. */
.tool-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(22, 199, 132, 0.12);
  color: var(--success-green-strong);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 0.85rem;
  font-weight: 600;
}
.tool-badge svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Converter tools: drop zone, options, progress, result. */
.dropzone {
  border: 2px dashed rgba(16, 32, 51, 0.22);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.5);
  padding: 34px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 120ms ease, background 120ms ease;
}
.dropzone:hover,
.dropzone:focus-visible {
  border-color: var(--record-red);
  background: rgba(255, 90, 79, 0.05);
  outline: none;
}
.dropzone.is-dragover {
  border-color: var(--record-red);
  background: rgba(255, 90, 79, 0.09);
}
.dropzone.is-disabled {
  opacity: 0.55;
  pointer-events: none;
}
.dropzone strong {
  display: block;
  font-size: 1.05rem;
  margin-bottom: 4px;
}
.dropzone span {
  color: var(--muted);
  font-size: 0.9rem;
}
.dropzone-icon {
  width: 40px;
  height: 40px;
  margin: 0 auto 10px;
  fill: none;
  stroke: var(--record-red);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.file-pick-info {
  margin-top: 12px;
  font-size: 0.9rem;
  color: var(--ink);
  font-weight: 600;
  word-break: break-all;
}

.tool-options {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 16px;
}
.tool-options .tool-field {
  flex: 1 1 140px;
}
.tool-number {
  width: 100%;
  padding: 9px 11px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font: inherit;
}

.progress {
  margin-top: 16px;
  height: 16px;
  border-radius: 999px;
  background: rgba(16, 32, 51, 0.08);
  border: 1px solid var(--line);
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: var(--record-red);
  transition: width 120ms linear;
}
/* Indeterminate sweep while ffmpeg is warming up or progress is unknown. */
.progress-bar[data-indeterminate] {
  width: 40% !important;
  background: linear-gradient(90deg, transparent, var(--record-red), transparent);
  animation: tool-indeterminate 1.1s ease-in-out infinite;
}
@keyframes tool-indeterminate {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(320%); }
}
.progress-text {
  margin-top: 6px;
  font-size: 0.85rem;
  color: var(--muted);
  text-align: center;
}

.tool-result {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
.tool-result video,
.tool-result img {
  width: 100%;
  max-height: 420px;
  object-fit: contain;
  border-radius: 12px;
  background: #0b1622;
  display: block;
}
.tool-result-info {
  margin: 12px 0;
  font-weight: 600;
  color: var(--ink);
}
.tool-result audio {
  width: 100%;
  display: block;
}

/* Teleprompter */
.prompter-script {
  width: 100%;
  min-height: 120px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font: inherit;
  resize: vertical;
}
.prompter-stage {
  position: relative;
  height: 52vh;
  min-height: 320px;
  margin-top: 16px;
  background: #0b1622;
  border-radius: 16px;
  overflow: hidden;
}
.prompter-stage.is-mirrored {
  transform: scaleX(-1);
}
.prompter-scroller {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  padding: 40px 8%;
  margin: 0;
  color: #fff;
  font-size: 44px;
  line-height: 1.5;
  font-weight: 600;
  text-align: center;
  white-space: pre-wrap;
  word-break: break-word;
  will-change: transform;
}
.prompter-stage:fullscreen {
  height: 100vh;
  border-radius: 0;
}
.prompter-stage:fullscreen .prompter-scroller {
  padding: 14vh 10%;
}
.prompter-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 14px;
  margin-top: 16px;
}
.prompter-controls .tool-field {
  flex: 1 1 150px;
}
.prompter-range {
  width: 100%;
  accent-color: var(--record-red);
}

/* Hub: tool directory cards. */
.tool-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  gap: 18px;
  margin-top: 8px;
}
.tool-link-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 20px;
  position: relative;
  text-decoration: none;
  color: var(--ink);
  transition: transform 120ms ease, border-color 120ms ease;
}
.tool-link-card:hover {
  transform: translateY(-2px);
  border-color: var(--record-red);
}
/* "Opens a page" affordance: a chevron on each clickable card (the coming-soon
   divs are not anchors, so they get none). Always visible so it reads as a link
   on touch devices too; nudges right on hover. */
a.tool-link-card { padding-right: 46px; }
a.tool-link-card::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 20px;
  width: 9px;
  height: 9px;
  border-right: 2.5px solid var(--record-red);
  border-top: 2.5px solid var(--record-red);
  transform: translateY(-50%) rotate(45deg);
  opacity: 0.6;
  transition: right 140ms ease, opacity 140ms ease;
}
a.tool-link-card:hover::after { right: 16px; opacity: 1; }
.tool-link-card strong {
  font-size: 1.1rem;
}
.tool-link-card span {
  color: var(--muted);
  line-height: 1.45;
}
.tool-link-card.is-soon {
  opacity: 0.72;
  cursor: default;
}
.tool-link-card .tool-soon-tag {
  align-self: flex-start;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 700;
  color: var(--muted);
  background: rgba(16, 32, 51, 0.06);
  border-radius: 999px;
  padding: 3px 9px;
}
