/* Face2Face — danfo yellow on black. One display family (Archivo, variable width + weight). */

:root {
  --black: #0B0B0A;
  --coal: #161614;
  --soot: #22221F;
  --line: #2E2E2A;
  --yellow: #FFD400;
  --yellow-deep: #E6BE00;
  --paper: #F6F3EA;
  --muted: #9C9A90;
  --red: #FF4D3D;
  --radius: 14px;
  --font: "Archivo", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --chev: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 9l6 6 6-6' fill='none' stroke='%23F6F3EA' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  --chev-dark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 9l6 6 6-6' fill='none' stroke='%230B0B0A' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--black);
  color: var(--paper);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}

body {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  grid-template-columns: minmax(0, 1fr);
  height: 100dvh;
  width: 100%;
  overflow: hidden;
}

.bar, .stage, .dock, .prefs, .pane { min-width: 0; }

/* ---------- top bar ---------- */

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px 8px;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  text-decoration: none;
  color: var(--paper);
  font-weight: 900;
  font-stretch: 112%;
  font-size: 20px;
  letter-spacing: -0.03em;
  line-height: 1;
}

.wordmark .two {
  display: inline-grid;
  place-items: center;
  width: 1.15em;
  height: 1.15em;
  margin: 0 3px;
  border-radius: 50%;
  background: var(--yellow);
  color: var(--black);
  font-size: 0.9em;
  transform: rotate(-8deg);
}

.online {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--coal);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.online i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--yellow);
  animation: ping 2s infinite;
}

@keyframes ping {
  0% { box-shadow: 0 0 0 0 rgba(255, 212, 0, 0.55); }
  70% { box-shadow: 0 0 0 8px rgba(255, 212, 0, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 212, 0, 0); }
}

/* ---------- split stage ---------- */

.stage {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
  margin: 0 16px;
  min-height: 0;
}

.pane {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--coal);
  border: 1px solid var(--line);
  min-height: 0;
  container-type: size;
}

.pane video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
}

.pane.you video { transform: scaleX(-1); }

.tag {
  position: absolute;
  left: 14px;
  top: 14px;
  padding: 6px 10px;
  border-radius: 6px;
  background: rgba(11, 11, 10, 0.7);
  color: var(--paper);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  z-index: 2;
}

.you-tag { background: var(--yellow); color: var(--black); }

/* stranger pane: a poster, not a card in the middle */

.cover {
  position: absolute;
  inset: 0;
  background: var(--yellow);
  color: var(--black);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 24px;
  z-index: 1;
}

.cover .tag { background: var(--black); color: var(--yellow); }

.poster { margin-top: auto; }

.headline {
  margin: 0 0 10px;
  font-weight: 900;
  font-stretch: 100%;
  font-size: clamp(28px, 10cqw, 96px);
  line-height: 0.92;
  letter-spacing: -0.04em;
}

.sub {
  margin: 0;
  font-size: clamp(14px, 2.4cqw, 20px);
  font-weight: 500;
  line-height: 1.35;
  max-width: 38ch;
  opacity: 0.85;
}

/* two faces nudging toward each other while we search */
.pulse {
  display: none;
  gap: 10px;
  margin-top: 18px;
}

.pulse span {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--black);
  animation: nudge 1.1s ease-in-out infinite;
}

.pulse span:last-child { animation-delay: -0.55s; }

@keyframes nudge {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(6px); }
}

.steps {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  margin: 22px 0 0;
  padding: 16px 0 0;
  border-top: 2px solid rgba(11, 11, 10, 0.18);
  list-style: none;
  font-size: 13px;
  font-weight: 600;
}

.steps li { display: inline-flex; align-items: center; gap: 8px; }

.steps b {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--black);
  color: var(--yellow);
  font-size: 11px;
}

.stage[data-state="waiting"] .pulse,
.stage[data-state="connecting"] .pulse { display: flex; }
.stage:not([data-state="idle"]) .steps { display: none; }
.stage[data-state="connected"] .cover { display: none; }

/* your pane before the camera is on */

.you-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
}

.stage:not([data-state="idle"]) .you-empty,
.you-empty.off { display: none; }

/* ---------- dock: preferences under the stranger, Start under you ---------- */

.dock {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  margin: 0 16px;
  padding: 10px 0 calc(10px + env(safe-area-inset-bottom));
}

.prefs {
  grid-column: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.go-row {
  grid-column: 2;
  display: flex;
  align-items: center;
  gap: 8px;
}

.go-row .go { flex: 1; justify-content: center; }

/* On desktop the preference pills stand as tall as the Start button. */
.dock { --dock-h: 62px; }
.dock .seg { height: var(--dock-h); padding: 0 6px 0 0; }
.dock .seg .pick { padding-top: 10px; padding-bottom: 10px; }
.dock .go-row .go { height: var(--dock-h); padding-top: 0; padding-bottom: 0; }
.dock .go-row .btn.quiet { height: var(--dock-h); padding-top: 0; padding-bottom: 0; }

.seg {
  display: inline-flex;
  align-items: center;
  padding: 3px;
  border-radius: 999px;
  background: var(--coal);
  border: 1px solid var(--line);
}

.seg-label {
  padding: 0 8px 0 10px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}

.seg label { position: relative; }

.seg input {
  position: absolute;
  opacity: 0;
  inset: 0;
  margin: 0;
  cursor: pointer;
}

.seg span:not(.seg-label) {
  display: inline-block;
  padding: 8px 13px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  color: var(--paper);
  cursor: pointer;
  user-select: none;
}

.seg input:checked + span { background: var(--yellow); color: var(--black); }

/* Start was pressed before this was filled in */
.seg.need { border-color: var(--yellow); animation: shake 0.5s ease; }

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-5px); }
  40%, 80% { transform: translateX(5px); }
}
.seg input:focus-visible + span { outline: 2px solid var(--yellow); outline-offset: 2px; }

.seg .pick {
  max-width: 200px;
  padding: 8px 30px 8px 13px;
  border: 0;
  border-radius: 999px;
  background: var(--soot) var(--chev) no-repeat right 10px center / 14px;
  color: var(--paper);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.seg .pick:hover { background-color: var(--line); }
.seg .pick:focus-visible { outline: 2px solid var(--yellow); outline-offset: 2px; }
.pick[aria-expanded="true"] { background-color: var(--yellow) !important; color: var(--black) !important; background-image: var(--chev-dark) !important; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font: inherit;
  font-weight: 800;
  letter-spacing: -0.01em;
  cursor: pointer;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 12px 20px;
  color: var(--paper);
  background: var(--coal);
  transition: transform 0.08s ease, background 0.15s ease;
}

.btn:active { transform: scale(0.97); }

.btn.go {
  background: var(--yellow);
  color: var(--black);
  border-color: var(--yellow);
  padding: 18px 34px;
  font-size: 19px;
}

.btn.go:hover { background: var(--yellow-deep); }
.btn.quiet { background: transparent; }
.btn.quiet:hover { background: var(--coal); }
.btn.report { color: var(--red); }
.btn:disabled { opacity: 0.5; cursor: default; }

/* which controls show when */
.stage[data-state="idle"] ~ .dock #stop,
.stage[data-state="idle"] ~ .dock #report,
.stage[data-state="idle"] ~ .dock #next { display: none; }
.stage:not([data-state="idle"]) ~ .dock #start,
.stage:not([data-state="idle"]) ~ .dock .prefs { display: none; }

/* In a call the dock shrinks to a floating bar over the stage, and the panes take the room. */
.stage:not([data-state="idle"]) { margin-bottom: 16px; }

.stage:not([data-state="idle"]) ~ .dock {
  position: fixed;
  left: 50%;
  bottom: calc(14px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: flex;
  margin: 0;
  padding: 6px;
  border-radius: 999px;
  background: rgba(11, 11, 10, 0.78);
  border: 1px solid var(--line);
  backdrop-filter: blur(10px);
  z-index: 10;
}

.stage:not([data-state="idle"]) ~ .dock .go-row { gap: 6px; }
.stage:not([data-state="idle"]) ~ .dock .go { padding: 14px 96px; }
.stage:not([data-state="idle"]) ~ .dock .btn.quiet { border-color: transparent; }

/* ---------- report sheet ---------- */

.sheet {
  width: min(100% - 32px, 400px);
  margin: auto;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--coal);
  color: var(--paper);
}

.sheet::backdrop { background: rgba(0, 0, 0, 0.65); backdrop-filter: blur(3px); }

.report-form {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 20px;
}

.report-form h2 {
  margin: 0 0 8px;
  font-size: 20px;
  font-weight: 900;
  letter-spacing: -0.03em;
}

.report-form button {
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--soot);
  color: var(--paper);
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

.report-form button:hover { background: var(--line); }
.report-form button:focus-visible { outline: 2px solid var(--yellow); outline-offset: 1px; }
.report-form .cancel { margin-top: 8px; background: transparent; color: var(--muted); text-align: center; }

/* ---------- place menu (our own, not the browser's) ---------- */

.menu {
  position: fixed;
  z-index: 50;
  width: 300px;
  max-height: min(420px, 70vh);
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--coal);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.6);
  overflow: hidden;
}

.menu[hidden] { display: none; }

.menu-search {
  margin: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--black);
  color: var(--paper);
  font: inherit;
  font-size: 14px;
}

.menu-search::placeholder { color: var(--muted); }
.menu-search:focus { outline: 2px solid var(--yellow); outline-offset: -1px; }

.menu-list {
  overflow-y: auto;
  padding: 0 6px 8px;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}

.menu-group {
  padding: 10px 10px 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--paper);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.menu-item:hover, .menu-item.active { background: var(--soot); }

.menu-item[aria-selected="true"] {
  background: var(--yellow);
  color: var(--black);
}

.menu-item[aria-selected="true"]::after {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--black);
}

.menu-empty { padding: 14px 10px; color: var(--muted); font-size: 13px; }

/* ---------- phones ---------- */

@media (max-width: 760px) {
  .stage {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) minmax(0, 1fr);
    margin: 0 12px;
  }
  .cover { padding: 16px; }
  .headline { font-size: clamp(24px, 9.5cqw, 40px); }
  .sub { font-size: 14px; }
  .steps { display: none; }
  .dock {
    grid-template-columns: minmax(0, 1fr);
    margin: 0 12px;
    padding: 10px 0 calc(10px + env(safe-area-inset-bottom));
  }
  .go-row { grid-column: 1; grid-row: 2; }

  /* One card, three rows, a label column. Square-ish corners; hairlines instead of pill borders. */
  .prefs {
    grid-column: 1;
    grid-row: 1;
    display: block;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--coal);
    overflow: hidden;
  }
  .seg {
    width: 100%;
    height: auto;
    gap: 6px;
    padding: 6px 8px 6px 0;
    border: 0;
    border-radius: 0;
    background: transparent;
  }
  .seg + .seg { border-top: 1px solid var(--line); }
  .seg-label {
    flex: 0 0 52px;
    padding: 0 0 0 12px;
    font-size: 10px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
  }
  /* "I'm" row: the second label ("in") is inline, not a column */
  .seg .seg-label + label ~ .seg-label { flex: 0 0 auto; padding: 0 2px 0 6px; }
  .seg label { flex: 1; }
  .seg span:not(.seg-label) {
    display: block;
    padding: 9px 6px;
    border-radius: 8px;
    background: var(--soot);
    font-size: 13px;
    text-align: center;
  }
  .seg .pick {
    flex: 1.2;
    max-width: none;
    padding: 9px 26px 9px 10px;
    border-radius: 8px;
    font-size: 13px;
    text-align: left;
  }
  .seg.need { border-color: var(--line); box-shadow: inset 3px 0 0 var(--yellow); }
  .menu { width: calc(100vw - 24px); left: 12px !important; right: 12px; }
  .stage:not([data-state="idle"]) { margin-bottom: 12px; }
  .stage:not([data-state="idle"]) ~ .dock { width: calc(100% - 24px); }
  .stage:not([data-state="idle"]) ~ .dock .go-row { width: 100%; }
  .stage:not([data-state="idle"]) ~ .dock .go { padding: 12px 16px; }
}
