/* Voice Translator page (page-voice-translator.php). Loaded on that template only.
   The heading block (.ft-hero) is styled in style.css, the same on every tool page. */

.vt {
  --vt-ink: #0f172a;
  --vt-text: #1e293b;
  --vt-muted: #52607a;
  --vt-blue: #1d4ed8;
  --vt-blue-soft: #eaf1ff;
  --vt-rose: #e11d48;
  --vt-rose-deep: #be123c;
  --vt-rose-soft: #fff0f3;
  --vt-card: #ffffff;
  --vt-line: #d7deea;
  box-sizing: border-box;
  color: var(--vt-text);
  margin: 0 auto;
  max-width: 1180px;
  padding: 26px 16px 28px;
}
.vt *,
.vt *::before,
.vt *::after { box-sizing: border-box; }

body:not(.dark) {
  background: linear-gradient(180deg, #dfe5fd 0, #e9ecfd 300px, #f6eefb 760px, #fbf5fb 100%) no-repeat #fbf5fb;
}

/* ---------- The tool ---------- */

/* The two cards reach the edges of the tool: no white frame at the sides or under them. */
.vt-tool {
  background: var(--vt-card);
  border-radius: 24px;
  box-shadow: 0 12px 40px rgba(15, 23, 42, .10);
  padding: 12px 0 0;
  position: relative;
  z-index: 1;
}

.vt-mic:focus-visible,
.vt-round:focus-visible,
.vt-swap:focus-visible,
.vt-type:focus-visible,
.vt-x:focus-visible { outline: 2px solid var(--vt-ink); outline-offset: 2px; }

/* Languages, with the button that makes them change places between them. */
.vt-langs {
  align-items: center;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  margin: 0 24px 12px;
}
.vt-lang { display: flex; flex-direction: column; min-width: 0; position: relative; }
.vt-lang .cld-trigger { width: 100%; }
.vt-lang select,
.vt-lang .cld-trigger {
  border-radius: 999px !important;
  font-size: 20px !important;
  font-weight: 600;
  min-height: 52px;
}
/* The site's own menu replaces the plain one; the plain one stays for the script. */
.vt-lang:has(.cld-trigger) select {
  clip-path: inset(50%);
  height: 1px;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
  position: absolute;
  width: 1px;
}
.vt-swap {
  align-items: center;
  background: var(--vt-card);
  border: 1px solid var(--vt-line);
  border-radius: 50%;
  box-shadow: 0 4px 12px rgba(15, 23, 42, .12);
  color: #2563eb;
  cursor: pointer;
  display: flex;
  height: 46px;
  justify-content: center;
  padding: 0;
  transition: transform .2s;
  width: 46px;
}
.vt-swap:hover { transform: rotate(180deg); }
.vt-swap svg { height: 22px; width: 22px; }

/* The ad under the languages, as wide as the tool. It takes no room while it is empty. */
.vt-adarea { overflow: hidden; text-align: center; }
.vt-adarea > div:not(:empty) { margin-bottom: 2px; }

/* ---------- The two cards: the first is rose, the second blue ---------- */

/* The ad between the cards is for phones (composer.js fills it under 1025px). */
.vt-ad2 { display: none; }

.vt-cards { display: grid; gap: 10px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.vt-card {
  border: 2px solid var(--vt-edge);
  border-radius: 22px;
  display: flex;
  flex-direction: column;
  min-height: 404px;   /* the height of the text box on the translation pages */
  padding: 24px 26px;
  position: relative;
  transition: border-color .15s, box-shadow .15s;
}
.vt-card-a {
  --vt-c: var(--vt-rose);
  --vt-c-deep: var(--vt-rose-deep);
  --vt-glow: rgba(225, 29, 72, .18);
  --vt-edge: #f6a5b7;
  background: var(--vt-rose-soft);
}
/* --vt-sky is the skyline picture, set on the card in the template. */
.vt-card-b {
  --vt-c: #2563eb;
  --vt-c-deep: var(--vt-blue);
  --vt-glow: rgba(37, 99, 235, .20);
  --vt-edge: #a9c3f5;
  background: var(--vt-blue-soft) var(--vt-sky) no-repeat center bottom / 100% auto;
  background-blend-mode: multiply;
}
.vt-card:focus-within,
.vt-card.is-on { border-color: var(--vt-c); box-shadow: 0 0 0 3px var(--vt-glow); }

/* Top of a card: microphone, text, delete cross. */
.vt-in-row { align-items: flex-start; display: flex; gap: 14px; }
.vt-mic {
  align-items: center;
  background: linear-gradient(160deg, #fb7185, #e11d48);
  border: 0;
  border-radius: 50%;
  box-shadow: 0 8px 18px rgba(225, 29, 72, .30);
  color: #ffffff;
  cursor: pointer;
  display: flex;
  flex: none;
  height: 60px;
  justify-content: center;
  padding: 0;
  width: 60px;
}
.vt-card-b .vt-mic {
  background: linear-gradient(160deg, #60a5fa, #1d4ed8);
  box-shadow: 0 8px 18px rgba(29, 78, 216, .30);
}
.vt-card.is-on .vt-mic {
  animation: vt-pulse 1.2s ease-in-out infinite;
  background: #ffffff;
  color: var(--vt-c-deep);
  outline: 3px solid var(--vt-c);
}
/* A browser without speech input: the cards are typed in. */
.vt-tool.no-mic .vt-mic { display: none; }
.vt-in {
  background: transparent;
  border: 0;
  color: var(--vt-ink);
  flex: 1 1 auto;
  font-family: inherit;
  font-size: 20px;
  font-weight: 600;
  line-height: 1.45;
  margin: 0;
  max-height: 204px;
  min-height: 58px;
  min-width: 0;
  outline: 0;
  overflow-y: auto;
  padding: 14px 0 0;
  resize: none;
}
.vt .vt-in::placeholder { color: var(--vt-muted) !important; font-weight: 400; opacity: 1; }
.vt-x {
  align-items: center;
  background: #ffffff;
  border: 1px solid var(--vt-line);
  border-radius: 50%;
  color: #3c4350;
  cursor: pointer;
  display: flex;
  flex: none;
  height: 36px;
  justify-content: center;
  margin-top: 10px;
  padding: 0;
  position: relative;
  width: 36px;
}
.vt-x::after { content: ""; inset: -6px; position: absolute; }   /* a larger place to tap */
.vt-x[hidden],
.vt-or[hidden],
.vt-note[hidden] { display: none; }

/* "or / Type Text", there while both cards are empty. */
.vt-or { align-items: center; display: flex; flex-direction: column; gap: 14px; margin: 12px 0 0; }
.vt-or-line {
  align-items: center;
  color: var(--vt-muted);
  display: flex;
  font-size: 15px;
  gap: 14px;
  width: min(360px, 90%);
}
.vt-or-line::before,
.vt-or-line::after { background: var(--vt-edge); content: ""; flex: 1 1 0; height: 1px; }
.vt-type {
  align-items: center;
  background: #ffffff;
  border: 1px solid var(--vt-edge);
  border-radius: 999px;
  color: var(--vt-ink);
  cursor: pointer;
  display: inline-flex;
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  gap: 10px;
  min-height: 48px;
  padding: 0 24px;
}

/* Foot of a card: the count, then the sound wave and listen, copy, save. */
.vt-counter {
  color: var(--vt-muted);
  display: block;
  font-size: 13px;
  margin-top: auto;
  padding-top: 10px;
  text-align: right;
}
.vt-foot { align-items: center; display: flex; gap: 16px; padding-top: 6px; }
.vt-acts { display: flex; flex: none; gap: 10px; }
.vt-round {
  align-items: center;
  background: #ffffff;
  border: 1px solid var(--vt-edge);
  border-radius: 50%;
  color: var(--vt-ink);
  cursor: pointer;
  display: flex;
  flex: none;
  height: 48px;
  justify-content: center;
  padding: 0;
  width: 48px;
}
.vt-round:disabled { cursor: default; opacity: .55; }
.vt-play { color: var(--vt-c-deep); }

/* The wave of the second card shows only while that card listens, so that the
   skyline stays in view. */
.vt-wave {
  align-items: center;
  display: flex;
  flex: 1 1 auto;
  gap: 4px;
  height: 44px;
  justify-content: center;
  min-width: 0;
  opacity: .45;
  overflow: hidden;
}
.vt-card-b .vt-wave { opacity: 0; }
.vt-card.is-on .vt-wave { opacity: 1; }
.vt-wave span {
  animation: vt-idle var(--t) ease-in-out infinite;
  animation-delay: var(--d);
  background: var(--vt-c);
  border-radius: 3px;
  flex: 1 1 0;
  height: var(--h);
  max-width: 7px;
  min-width: 2px;
}
.vt-card.is-on .vt-wave span { animation-duration: .55s; animation-name: vt-wave; }

@keyframes vt-idle  { 0%, 100% { transform: scaleY(.45); } 50% { transform: scaleY(.8); } }
@keyframes vt-wave  { 0%, 100% { transform: scaleY(.3); }  50% { transform: scaleY(1); } }
@keyframes vt-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(225, 29, 72, .35); } 50% { box-shadow: 0 0 0 12px rgba(225, 29, 72, 0); } }
@media (prefers-reduced-motion: reduce) {
  .vt-wave span,
  .vt-card.is-on .vt-mic { animation: none; }
  .vt-swap:hover { transform: none; }
}

/* The one line of notices under the cards. */
.vt-note {
  border-left: 4px solid var(--vt-blue);
  color: var(--vt-ink);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  margin: 12px 24px 14px;
  overflow-wrap: break-word;
  padding: 2px 0 2px 10px;
}
.vt-note.is-error { border-left-color: #b3261e; color: #8c1d18; }

/* ---------- Three short points under the tool ---------- */

.vt-points {
  background: linear-gradient(90deg, #fff7ec, #ffffff 45%, #f3f7ff);
  border: 1px solid var(--vt-line);
  border-radius: 999px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  list-style: none;
  margin: 18px 40px 0;
  padding: 18px 34px;
}
.vt-points li { align-items: center; display: flex; gap: 18px; justify-content: center; margin: 0; padding: 0 18px; }
.vt-points li + li { border-left: 1px solid var(--vt-line); }
.vt-points li svg { flex: none; }
.vt-points li div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.vt-points strong { color: var(--vt-ink); font-size: 18px; }
.vt-points span { color: var(--vt-text); font-size: 16px; }

.vt .custom-content { margin-top: 22px; }

/* ---------- Tablets and phones: one card under the other ---------- */

@media (max-width: 1024px) {
  .vt-langs { margin: 0 16px 10px; }
  /* No room between the first card, the ad and the second card. */
  .vt-cards { gap: 0; grid-template-columns: minmax(0, 1fr); }
  .vt-ad2 { display: block; overflow: hidden; text-align: center; }
  .vt-ad2:empty + .vt-card-b { margin-top: 3px; }
  /* Low cards on phones. "or / Type Text" would not fit; the placeholder says the same. */
  .vt-card { min-height: 198px; }
  .vt-or { display: none; }
  .vt-points { border-radius: 20px; grid-template-columns: minmax(0, 1fr); margin: 18px 0 0; padding: 6px 18px; }
  .vt-points li { justify-content: flex-start; padding: 10px 0; }
  .vt-points li + li { border-left: 0; border-top: 1px solid var(--vt-line); }
}

@media (max-width: 600px) {
  .vt { padding: 4px 10px 22px; }
  .vt-tool { border-radius: 20px; padding: 8px 0 0; }
  .vt-langs { gap: 6px; margin: 0 8px 8px; }
  .vt-lang select,
  .vt-lang .cld-trigger { font-size: 16px !important; min-height: 44px; }
  .vt-swap { height: 38px; width: 38px; }
  .vt-swap svg { height: 18px; width: 18px; }
  .vt-card { padding: 8px 14px; }
  .vt-counter { line-height: 1.2; padding-top: 4px; }
  .vt-foot { padding-top: 2px; }
  .vt-in { font-size: 18px; min-height: 48px; padding-top: 12px; }
  .vt-mic { height: 54px; width: 54px; }
  .vt-foot { gap: 10px; }
  .vt-round { height: 40px; width: 40px; }
  .vt-wave { height: 36px; }
}

/* ---------- Dark setting of the site ---------- */

.dark .vt {
  --vt-ink: #f1f5f9;
  --vt-text: #e2e8f0;
  --vt-muted: #a8b3c7;
  --vt-blue: #93b4ff;
  --vt-blue-soft: #172443;
  --vt-rose-soft: #2c1622;
  --vt-card: #1c2238;
  --vt-line: #2f3a5c;
}
.dark .vt-card-a { --vt-c: #fb7185; --vt-c-deep: #fecdd3; --vt-edge: #7a2a40; }
/* The skyline is drawn on a light ground, so the dark setting leaves it out. */
.dark .vt-card-b { --vt-c: #6f9bff; --vt-c-deep: #c7d7ff; --vt-edge: #33508f; background-image: none; }
.dark .vt-card.is-on .vt-mic { background: #0f172a; }
.dark .vt-round,
.dark .vt-x,
.dark .vt-type { background: #232b47; border-color: #3a4670; color: #f1f5f9; }
.dark .vt-points { background: var(--vt-card); }
.dark .vt-note.is-error { color: #ffb4ab; }

/* ---------- Wide screens ---------- */

/* The share buttons float at the left edge, so the page keeps clear of them. */
@media (min-width: 1025px) {
  .vt { max-width: min(1180px, calc(100vw - 220px)); }
}
