/*
  app.css — the whole mitran look. Two colours, one font. See UI.md §1.
  Rule of thumb: if you reach for a third colour, use a border or a fill instead.
*/

:root {
  --fg: #000000;
  --bg: #ffffff;
  --font: system-ui, -apple-system, "Segoe UI", sans-serif;
  --border: 2px solid var(--fg);
  --tap: 48px;
  --gap: 16px;
  color-scheme: light;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: 18px;
  line-height: 1.4;
  -webkit-text-size-adjust: 100%;
}

[hidden] { display: none !important; }

/* All text is lower case (UI.md §4), including transcripts. */
html { text-transform: lowercase; }

/* ---- layout ---------------------------------------------------------- */

#app { height: 100%; }

/* One screen at a time; single centred column, phone-width. */
.screen {
  min-height: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: calc(var(--gap) * 2) calc(var(--gap) * 1.5);
  padding-bottom: max(calc(var(--gap) * 2), env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: calc(var(--gap) * 1.5);
}
.screen.center { justify-content: center; text-align: center; }

.stack { display: flex; flex-direction: column; gap: var(--gap); }
.bottom { margin-top: auto; }

/* ---- type ------------------------------------------------------------ */

.wordmark { font-size: 40px; font-weight: 700; letter-spacing: -0.02em; }
h2 { font-size: 24px; font-weight: 700; }
h3 { font-size: 18px; font-weight: 700; }
.status { font-size: 22px; }
.error { font-weight: 700; }

/* ---- controls -------------------------------------------------------- */

button, input {
  font: inherit;
  color: var(--fg);
  border-radius: 0;
  -webkit-appearance: none;
  appearance: none;
  text-transform: inherit; /* form controls don't inherit it by default */
}

button {
  min-height: var(--tap);
  padding: 12px 16px;
  border: var(--border);
  background: var(--bg);
  cursor: pointer;
  width: 100%;
  touch-action: manipulation;
}
button.primary { background: var(--fg); color: var(--bg); }
button.secondary { background: var(--bg); color: var(--fg); }
button.link { border: none; min-height: var(--tap); text-decoration: underline; width: auto; align-self: center; }
button:disabled { opacity: 1; cursor: default; }
button.primary:disabled { background: var(--bg); color: var(--fg); }

:focus-visible { outline: 3px solid var(--fg); outline-offset: 3px; }

input {
  min-height: var(--tap);
  padding: 10px 12px;
  border: var(--border);
  background: var(--bg);
  font-size: 20px; /* ≥16px stops iOS zooming on focus */
  width: 100%;
}

/* Choice group: selected option is filled black. */
.choices { display: flex; gap: 8px; }
.choices button[aria-pressed="true"] { background: var(--fg); color: var(--bg); }

/* Current session (role screen): open sessions the talker can rejoin. */
.current { border: var(--border); padding: var(--gap); display: flex; flex-direction: column; gap: 12px; }
.current li { display: flex; flex-direction: column; gap: 8px; }

/* ---- call screen ----------------------------------------------------- */

.screen.call {
  max-width: none;
  height: 100%;
  padding: 0;
  gap: 0;
  position: relative;
}

.call-top {
  position: absolute; top: 0; left: 0; right: 0; z-index: 2;
  padding: max(12px, env(safe-area-inset-top)) 16px 0;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  pointer-events: none;
}

.timer {
  font-size: 32px; font-weight: 700;
  font-variant-numeric: tabular-nums;
  background: var(--bg); color: var(--fg);
  padding: 4px 12px; border: var(--border);
}
.timer.warning { background: var(--fg); color: var(--bg); } /* last 2 minutes */

.banner {
  width: 100%; max-width: 480px;
  background: var(--fg); color: var(--bg);
  padding: 10px 12px; text-align: center; font-weight: 700;
}

.call-stage {
  position: absolute; inset: 0;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
}
.call-stage.video { background: var(--fg); }

/* Other person fills the screen. */
.remote-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: var(--fg); }

/* Own camera: small corner tile, mirrored like a mirror. */
.self-video {
  position: absolute; z-index: 1;
  right: 16px; top: calc(max(12px, env(safe-area-inset-top)) + 64px);
  width: 28vw; max-width: 140px; aspect-ratio: 3 / 4; object-fit: cover;
  border: var(--border); border-color: var(--bg);
  background: var(--fg);
  transform: scaleX(-1);
}

/* Audio calls: the other person's role in large text. */
.remote-label { font-size: 44px; font-weight: 700; }
.call-stage.video .remote-label { display: none; }

.call-bottom {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 2;
  padding: 16px 24px max(24px, env(safe-area-inset-bottom));
  max-width: 480px; margin: 0 auto;
}
.call-stage.video ~ .call-bottom button.secondary { border-color: var(--fg); }
.call-bottom .error { background: var(--bg); color: var(--fg); padding: 10px 12px; }

/* ---- end / history --------------------------------------------------- */

.facts { display: grid; grid-template-columns: auto 1fr; gap: 4px 16px; }
.facts dt { font-weight: 700; }

/* Feedback (end screen): independent quality and vibe thumbs. */
.feedback { display: flex; flex-direction: column; gap: var(--gap); }
.feedback-group { display: flex; flex-direction: column; gap: 12px; }
.thumbs { display: flex; gap: 8px; }
.thumbs button { display: flex; align-items: center; justify-content: center; }
.thumbs svg { width: 28px; height: 28px; fill: currentColor; }
.thumbs button[aria-pressed="true"] { background: var(--fg); color: var(--bg); }

.transcript { display: flex; flex-direction: column; gap: 10px; border-top: var(--border); padding-top: 12px; }
.transcript p b { font-weight: 700; }

.list { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.list button { text-align: left; display: flex; flex-direction: column; gap: 2px; }
.list .meta { font-size: 16px; }
