/* Voice Translations (FGV International Affairs) — the app's only stylesheet.

   Self-contained on purpose: the page used to inherit a 1150-line article
   stylesheet for ~12 lines of reset, and silently picked up two article rules
   that were wrong here (a gold border above every transcript heading, and a
   media query that HID the brand on phones — the app's primary device).

   The screen is deliberately bare — a mark, two pickers, one button — so what
   is left has to be right: one card on a tinted ground, one accent, one type
   scale, and every state (focus, hover, live, error) drawn on purpose rather
   than left to the browser.  One theme only, light: see `color-scheme`. */

:root {
  /* The app is light, always: FGV's identity is white and blue, and a room
     translating between two strangers should look like an appliance, not like
     whatever the phone's OS happens to be set to tonight.  Pinning
     `color-scheme` is the load-bearing half — without it a phone in dark mode
     hands the page a DARK native <select> popup, whose light option text then
     sits invisible on the white list. */
  color-scheme: light;

  /* Blues sampled from the DINT logo (web/fgv-dint.png), so the page and the
     mark are literally the same colour.  The ground is tinted a step off white
     so the card reads as a surface rather than as the page itself. */
  --bg: #eef2f7;          /* a breath of the FGV blue, not a grey */
  --surface: #ffffff;
  --fg: #16192a;
  --muted: #6b6d70;       /* the logo's grey, darkened until it reads on white */
  --border: #e2e6ee;
  --accent: #003e7e;      /* FGV navy — the wordmark */
  --accent-hover: #002d5c;
  --accent-soft: #058ed0; /* FGV blue — the bar in the mark */
  --ring: #058ed0;
  --live: #12924a;
  --live-ring: rgba(18, 146, 74, 0.30);
  --warn-bg: #fff2f1;
  --warn-fg: #8c1d13;
  --warn-border: #f2cbc7;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 10px 28px rgba(16, 24, 40, 0.06);
}

* {
  box-sizing: border-box;
}

/* Any `display` declaration outranks the UA's `[hidden]` rule, so an element
   the app hides with `.hidden = true` can stay on screen anyway.  That is not
   hypothetical: `#live-header .badge { display: inline-block }` kept the
   "simulação" badge visible on the LIVE, non-simulated deployment — the page
   told the room it was a simulation while it was translating for real.  This
   rule closes the whole class. */
[hidden] {
  display: none !important;
}

body {
  margin: 0;
  font: 16px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

.live-page {
  background: var(--bg);
  color: var(--fg);
  min-height: 100vh;
}

/* One ring, drawn once, for everything focusable on the page. */
:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}

/* ---------- header ---------- */
#live-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 20px;
  padding-left: max(20px, env(safe-area-inset-left));
  padding-right: max(20px, env(safe-area-inset-right));
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 10;
}

/* Navy-on-transparent, sitting on the white header — the mark is used exactly
   as FGV ships it: no plate, no filter, no recolouring. */
#brand-logo {
  height: 28px;
  width: auto;
  display: block;
  flex: 0 0 auto;
}

/* The app's name, beside the institutional mark — the page carries no other
   heading, and no explanatory prose: the two pickers and the button are the
   whole interface. */
#live-header h1 {
  margin: 0;
  padding-left: 14px;
  border-left: 1px solid var(--border);
  font-size: 1rem;
  font-weight: 650;
  letter-spacing: -0.005em;
  color: var(--accent);
  white-space: nowrap;
}

#live-header .badge {
  margin-left: auto;
  /* No `display` here on purpose.  The header is a flex container, so this is
     blockified anyway — and an explicit declaration would outrank `[hidden]`
     and put the badge back on screen (see the [hidden] rule above). */
  padding: 3px 10px;
  border-radius: 999px;
  background: #ffe08a;
  color: #5c4400;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* ---------- the card ---------- */
#live-main {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: clamp(20px, 5vh, 56px) 18px;
  padding-bottom: calc(48px + env(safe-area-inset-bottom));
}

/* One vertical rhythm for the whole card: children carry no margins of their
   own, so a hidden child (the password field, the warning) leaves no gap
   behind it. */
.card {
  display: grid;
  gap: 20px;
  padding: 24px 22px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

/* ---------- language pickers ---------- */
.field label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.field select,
.field input[type="password"] {
  width: 100%;
  padding: 12px 14px;
  font: inherit;
  font-size: 1rem;
  color: var(--fg);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  transition: border-color 0.15s ease;
}

.field select:hover,
.field input[type="password"]:hover {
  border-color: var(--muted);
}

/* Belt and braces with `color-scheme: light`: state the option colours too,
   so the native popup is legible even where the OS ignores the hint. */
.field select option {
  background: var(--surface);
  color: var(--fg);
}

.field input[type="password"]::placeholder {
  color: var(--muted);
  opacity: 0.85;
}

/* The chevron is drawn from two borders rather than shipped as an image: one
   less asset to request, and it takes its colour from the same token as
   everything else grey on the page. */
.select-wrap {
  position: relative;
}

.select-wrap select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 40px;
}

.select-wrap::after {
  content: "";
  position: absolute;
  right: 16px;
  top: 50%;
  width: 7px;
  height: 7px;
  margin-top: -6px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  pointer-events: none;
}

/* Stacked at every width, never side by side.  Two columns inside a 480px
   card leaves ~145px per picker, which truncated "Português (Bra…" and wrapped
   "Idioma da contraparte" onto a second line while the other label stayed on
   one — the two rows then sat at different heights.  Full width costs one
   scroll-free screen and nothing else, and the exchange reads top-to-bottom,
   which is also how the phone is held. */
.field-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  justify-items: stretch;
}

.swap {
  justify-self: center;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  padding: 0;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 11px;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.swap:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.swap:active {
  transform: scale(0.94);
}

/* The exchange runs down the page, because the pickers do. */
.swap svg {
  transform: rotate(90deg);
}

/* ---------- the control ---------- */
button.primary {
  width: 100%;
  min-height: 52px;
  padding: 14px 16px;
  font: inherit;
  font-size: 1.05rem;
  font-weight: 650;
  color: #fff;
  background: var(--accent);
  border: 0;
  border-radius: 12px;
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.06s ease;
}

button.primary:hover {
  background: var(--accent-hover);
}

button.primary:active {
  transform: translateY(1px);
}

/* Live: stopping is not a destructive act, so it is drawn quiet — an outline,
   never an alarm. */
button.primary.running,
button.primary.running:hover {
  color: var(--fg);
  background: transparent;
  box-shadow: inset 0 0 0 1.5px var(--border);
}

/* ---------- status ---------- */
#status-row {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 0.9rem;
  color: var(--muted);
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex: 0 0 auto;
}

.dot.idle {
  background: var(--muted);
}

.dot.busy {
  background: #e0a100;
}

.dot.live {
  background: var(--live);
  animation: live-pulse 2.4s ease-out infinite;
}

.dot.error {
  background: #d93025;
}

@keyframes live-pulse {
  0% {
    box-shadow: 0 0 0 0 var(--live-ring);
  }

  70%,
  100% {
    box-shadow: 0 0 0 7px rgba(0, 0, 0, 0);
  }
}

/* ---------- the only message the room ever sees ---------- */
.warn {
  margin: 0;
  padding: 12px 14px;
  font-size: 0.92rem;
  color: var(--warn-fg);
  background: var(--warn-bg);
  border: 1px solid var(--warn-border);
  border-radius: 10px;
}

@media (max-width: 400px) {
  #brand-logo {
    height: 24px;
  }

  #live-header {
    gap: 11px;
    padding: 12px 15px;
  }

  #live-header h1 {
    font-size: 0.95rem;
    padding-left: 11px;
  }

  .card {
    padding: 20px 18px;
  }
}

/* A phone held between two people should not be animating at them if the
   person holding it asked the OS for less motion. */
@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
